mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-27 13:04:21 +01:00
Original version off of which work began. Crunchy2's last release (2.0.1b8)
This commit is contained in:
commit
ceacc3a72c
6
COMPILING.txt
Normal file
6
COMPILING.txt
Normal file
@ -0,0 +1,6 @@
|
||||
In order to compile Snes9xGx 2.0 with actual libogc, you need to:
|
||||
|
||||
1/ download last libogc source (04-02-2007)
|
||||
2/ replace gu_psasm.S in /LIBBOGC directory located in root libogc source directory by the one included with this release
|
||||
3/ recompile and reinstall libogc in your devkitPP environment (type 'make' then 'make install')
|
||||
4/ compile snes9xgx source (type 'make' in snes9xgx folder)
|
181
Makefile
Normal file
181
Makefile
Normal file
@ -0,0 +1,181 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
# Generic makefile for Gamecube projects
|
||||
#
|
||||
# Tab stops set to 4
|
||||
# | | | |
|
||||
# 0 1 2 3
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := bin/snes9xgx-crunchy2-wii
|
||||
BUILD := build
|
||||
SOURCES := source/snes9x source/unzip source/ngc source/smb
|
||||
INCLUDES := source/snes9x source/unzip source/ngc source/smb
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
||||
-DNGC -DNO_ASM -DCPU_SHUTDOWN -DSPC700C \
|
||||
-DSPC700_SHUTDOWN -DNEW_COLOUR_BLENDING \
|
||||
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
|
||||
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
|
||||
-DQUICK_SAVE_SLOT=4 -DSMB_SVID='"Crunchewy"' \
|
||||
-DSMB_IP='"192.168.1.111"' -DGW_IP='"192.168.1.1"'\
|
||||
-DFORCE_WII=1 \
|
||||
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
|
||||
-pipe
|
||||
|
||||
|
||||
LDFLAGS = $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||
|
||||
PREFIX := powerpc-gekko-
|
||||
|
||||
#export PATH:=/c/devkitPPC_r11/bin:/bin
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc -lm -lz -logcsys -lfreetype -lbba -lsdcard
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
run:
|
||||
psoload $(TARGET).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
reload:
|
||||
psoload -r $(TARGET).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
@echo output ... $(notdir $@)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
@echo linking ... $(notdir $@)
|
||||
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Compile Targets for C/C++
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.cpp
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.c
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.S
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.s
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
define bin2o
|
||||
cp $(<) $(*).tmp
|
||||
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
|
||||
--rename-section .data=.rodata,readonly,data,contents,alloc \
|
||||
--redefine-sym _binary_$*_tmp_start=$*\
|
||||
--redefine-sym _binary_$*_tmp_end=$*_end\
|
||||
--redefine-sym _binary_$*_tmp_size=$*_size\
|
||||
$(*).tmp $(@)
|
||||
echo "extern const u8" $(*)"[];" > $(*).h
|
||||
echo "extern const u32" $(*)_size[]";" >> $(*).h
|
||||
rm $(*).tmp
|
||||
endef
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
326
README.txt
Normal file
326
README.txt
Normal file
@ -0,0 +1,326 @@
|
||||
———————————————————————————————————————————————————————————————————————————
|
||||
:::::::::::::::×:::::::::::: .______ ::::::::::::::::::: _ ::::::::::
|
||||
| _________ / ___°/ -------. (_)'\ / `°|
|
||||
× /______ ° ---__---./ /___ _________ / --- / __| / \ °²
|
||||
× _______\ \ / ___ // /____//\_____ ° /---/ / ___ --- ×
|
||||
| °________/ / / / // /__ _______\ \ / / \ \ / / .||
|
||||
::::::::::::::::/ /::--/_______\::.________/::::/ /:::\ _ \::::::×:::
|
||||
:::::::°:::::::/___\:::::::::::::::::::::::::::::/ /::::/__/ \--::::::::
|
||||
°:::::::::::::::::×:::::::::::::::°::::×:::::::::\--/::::::::::::::::::×:::::
|
||||
———————————————————————————————————————————————————————————————————————•ßrK•
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· SNES9XGX v2.0.1b8 ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
*******************************************************************************
|
||||
PLEASE NOTE: THIS DOCUMENT IS A WORK IN PROGRESS - IT IS INCOMPLETE AND SOME OF
|
||||
THE INFORMATION IS OUT OF DATE
|
||||
*******************************************************************************
|
||||
|
||||
Welcome to the revolution in GameCube emulators! SNES9X is by far the most
|
||||
complete and accurate Super Nintendo Entertainment System emulator to date.
|
||||
Taking full power of the ATi-GX chipset and packed full of features that are
|
||||
to die for after playing your games you'll never want to come back to
|
||||
reality.
|
||||
|
||||
SNES9X is a very popular open source emulator mainly for the PC platform, but
|
||||
has seen many ports to other consoles such as the Nintendo DS, Microsoft XBOX
|
||||
and now thanks to SoftDev the Nintendo GameCube! This is a straight port and
|
||||
is not based on any previous SNES emulators that have existed for the
|
||||
GameCube. You can get more information on SNES9X here from the below URL.
|
||||
http://snes9x.ipherswipsite.com/
|
||||
|
||||
[What's New 2.0.1b8]
|
||||
* Added: SD slot B options for freezes, sram and loading of roms
|
||||
* Changed: SMB options no longer displayed in menus when run on a Wii
|
||||
* Changed: Game auto resumes running after resetting when choosing the "Reset
|
||||
Game" menu option
|
||||
* Fixed (maybe): Reading of DVDs past the 1.36 GB barrier (Wii only) please
|
||||
test! - svpe
|
||||
|
||||
[What Was New 2.0.1b7]
|
||||
* Fixed: Zip compressed freezes to memory card could become corrupted as the
|
||||
file size changed - fixed this by deleting the existing file before writing
|
||||
a new one if the file size increased. If the file got smaller or stayed the
|
||||
same the original file is updated, using less of the existing file if the
|
||||
actual file size is smaller. A check is made before deleting the existing
|
||||
freeze file to ensure that there is enough space available for the new
|
||||
file. Note that additional space equivalent to the new file size must be
|
||||
available. If not enough space is available the original freeze is retained
|
||||
and the user is informed of the lack of space.
|
||||
* Fixed: If option to auto-load freeze was selected, joypad config would not
|
||||
be restored since that is stored in SRAM. Resolved this for now by first
|
||||
loading SRAM if any and then loading the freeze. Obviously having to have
|
||||
both SRAM and freeze is not ideal, but this gets the job done if you have
|
||||
enough space on your memory card, SD card, etc.
|
||||
* Added prompt when returning to the menu with autosave enabled allowing the
|
||||
user choose whether or not to perform the save. Press A to save or B if you
|
||||
don't wish to save.
|
||||
* Added optional verification of Gamecube memory card saves. After writing
|
||||
the file it reads it back in and verifies that the written file matches
|
||||
what was to be saved. If it doesn't or if there was a problem opening the
|
||||
file it reports the problem to the user. Set this option in the preferences
|
||||
if desired.
|
||||
* Added Reset Gamecube/Wii menu item
|
||||
* Experimental DVD support for reading beyond 1.36 GB barrier on Wii. I have
|
||||
no way to test this, so please report on whether or not it works! Based on
|
||||
svpe's code.
|
||||
|
||||
NOTE: due to changes in the settings, this version will reset your emulator
|
||||
options settings, so if you had saved preferences you will need to make your
|
||||
changes to the emulator settings again and save them.
|
||||
|
||||
[What Was New 2.0.1b6a]
|
||||
* Fixed: Going up a directory when selecting a rom on a DVD wasn't working
|
||||
|
||||
[What's Was New 2.0.1b6]
|
||||
* PAL Wii support - no separate version necessary! - eke-eke
|
||||
* PAL roms now play at correct speed via internal timer, ntsc roms still use
|
||||
more accurate VSYNC timing - eke-eke
|
||||
* Zipped freezes to memory card - take 9-12 blocks or so - based on denman's
|
||||
code
|
||||
* Added option for auto save and load of freezes. For saving, can do both SRAM
|
||||
and Freeze if desired
|
||||
* Memory card saving and loading shows a progress bar
|
||||
* More miscellaneous ease-of-use improvements and cleanup
|
||||
* Fixed: pressing B to get out of a rom file selection screen no longer drops
|
||||
you all the way back to the main menu. Now goes back to choice of where to
|
||||
load ROM (the "Load from DVD", "Load from SMB"... screen)
|
||||
* Fixed: loading of joypad configuration in SRAM works again - no longer gets
|
||||
messed up
|
||||
|
||||
[ What Was New in 2.0.1b5]
|
||||
* B button implemented in all menus (returns to previous menu)
|
||||
* Fixed bug when freezing state to SD card - would crash if SD support was not
|
||||
previously initialized
|
||||
* Fixed double A button press needed after manual prefs/sram save to memory card
|
||||
* Fixed delay after pressing A button after saving freeze to SD card
|
||||
* Fixed problem of ".srm" SRAM file being created when SRAM was saved with no
|
||||
ROM loaded
|
||||
* Fixed version number in SRAM and preferences
|
||||
* Minor other code revisions
|
||||
|
||||
[ What Was New 2.0.1b1 through 2.0.1b4]
|
||||
* SRAM saving and loading from snes9x on other platforms via SD card or SMB
|
||||
* Games now autostart once loaded
|
||||
* After manually loading SRAM the emulator is automatically reset
|
||||
* Optional auto-loading of SRAM from memory card, SD or SMB after game loads
|
||||
* Optional auto-saving of SRAM to memory card, SD or SMB when returning to menu
|
||||
* TurboMode
|
||||
* Global emulator preferences
|
||||
* Menus redesigned (hopefully for the better!)
|
||||
* Comes in 6 variants, each auto-loading/saving preferences/sram to a different
|
||||
location: mcslota, mcslotb, sdslota, sdslotb, smb, and noload
|
||||
* ROM injector works again
|
||||
* A number of small improvements and bug fixes
|
||||
|
||||
[ What Was New in 2.0 WIP6 ]
|
||||
* Port of SNES9X 1.50
|
||||
* SMB support
|
||||
* SD support
|
||||
* Greatly improved emulation and timing for NTSC roms
|
||||
* Save states (freezes) to SD and SMB
|
||||
* Screen zoom
|
||||
* Improved font and display
|
||||
* ROM injector
|
||||
* ... and more ...
|
||||
|
||||
[ Features - OLD 1.43 LIST! ]
|
||||
* Port of SNES9X v1.43
|
||||
* Fullscreen Graphics
|
||||
* Sound Emulation
|
||||
* SRAM Manager
|
||||
* DVD Loading
|
||||
* 1-4 Player Support
|
||||
* Mode 7 Supported
|
||||
* Super FX Supported
|
||||
* SDD1, SRTC, SA-1 Supported
|
||||
* DSP1 & DSP2 Supported
|
||||
* Partial DSP4 Support
|
||||
* Supports Hi-Res 512x224 screens
|
||||
* Joliet Browser
|
||||
* PAD Configuration saved with SRAM
|
||||
* Memcard save/load time extended
|
||||
* Partial Zip support
|
||||
* Crude Timer
|
||||
* Sound Sync Option
|
||||
* Analog Clip
|
||||
* XenoGC Support (GC-Linux Homebrew DVD Compatibility)
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· SETUP & INSTALLATION ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
Unzip the archive into a folder. You'll find 6 variations of the dol, along
|
||||
with an "inject" tool for (optionally) injecting a rom into a dol. The six
|
||||
variants auto save and load preferences and sram to/from different locations
|
||||
as follows (you can also manually save and load SRAM to any location):
|
||||
|
||||
filename preferences/sram autoloading location
|
||||
------------------------- -------------------------------------
|
||||
snes9xGx201b8-mcslota.dol Memory card in slot A
|
||||
snes9xGx201b8-mcslotb.dol Memory card in slot B
|
||||
snes9xGx201b8-sdslota.dol SD card in SD adapter in slot A
|
||||
snes9xGx201b8-sdslotb.dol SD card in SD adapter in slot B
|
||||
snes9xGx201b8-smb.dol SMB share (see SMB section below)
|
||||
snes9xGx201b8-noload.dol none - doesn't load prefs nor autosave SRAM
|
||||
|
||||
|
||||
Your SNES rom images must be in the Super Magicom (SMC) or FIG format. Generally,
|
||||
all images you find will be in this format, but if you run across one that isn't
|
||||
please download RTOOL which will allow you to convert the image into SMC format.
|
||||
|
||||
You can load roms from DVD, SD card or SMB share. If you wish to use an SD card
|
||||
or SMB share, you must create an SNESROMS and an SNESSAVE folder at the top
|
||||
level (root) of the card or share. Put your roms in the SNESROMS folder. On DVD
|
||||
you can either place your roms at the top level, or optionally you may have an
|
||||
SNESROMS folder at the top level of the DVD, in which case the game selector
|
||||
will default to showing that folder when first entered. If you create a bootable
|
||||
DVD of Snes9xGx you can put roms on the same DVD.
|
||||
|
||||
Now that you have that set up all you need to do is load the dol of your choice.
|
||||
You can load it via sdload and an SD card in slot A, or by streaming it to your
|
||||
cube, or by booting a bootable DVD with it on it. This document doesn't cover
|
||||
how to do any of that. A good source for information on these topics is the
|
||||
tehskeen forums:
|
||||
|
||||
http://www.tehskeen.com/forums/
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· PARTIAL PKZIP SUPPORT ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
The Zip support in the emulator is courtesy of the zlib library. Currently,
|
||||
it supports only the Inflate method.
|
||||
|
||||
The good news is that this is by far the most common zip method!
|
||||
|
||||
You should note also that this implementation assumes that the first file
|
||||
in each archive is the required rom in smc/fig format.
|
||||
|
||||
In an attempt to save you time, we recommend using 7-Zip as the compressor,
|
||||
as it gives a gain of 5-25% better compression over standard zips.
|
||||
|
||||
To use 7-Zip compression on either linux or windows, use the following command:
|
||||
|
||||
7za a -tzip -mx=9 myrom.zip myrom.smc
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· MAIN MENU ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
Once the DOL file is loaded you will be presented with main menu where you can
|
||||
load a rom from DVD, SD or SMB, set options for the emulator, set the joypad
|
||||
configuration (on a per-game basis), save or load freezes, manage SRAM, etc.
|
||||
After loading a game the game will start running immediately. If you have the
|
||||
auto-load SRAM option enabled it will automatically load SRAM (if it exists)
|
||||
before starting play. You can return to the main menu at any time by pressing
|
||||
the c-stick (the yellow control stick) to the left, or by pressing L+R+X+Y.
|
||||
Return to the game by selecting "Resume Game" or by pressing the B button until
|
||||
play resumes.
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· TURBO MODE ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
TurboMode increases the playback speed of the game by about 2x. To use TurboMode
|
||||
simply press the c-stick (yellow control stick) to the right and hold it right
|
||||
as long as you want playback to be double-speed. Release the c-stick when you
|
||||
want normal playback speed to resume.
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· IMPORTING AND EXPORTING SRAM ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
Snes9xGx 2.0.1 now includes the ability to load SRAM from Snes9x on other
|
||||
platforms (Mac/PC/Linux/Etc) and to save back to those platforms. To use this
|
||||
feature simply save or load SRAM to/from SD card or an SMB share.
|
||||
|
||||
The only thing to be aware of is that Snes9xGx requires that the SRM file have a
|
||||
name that is the rom name (not necessarily the same as the file name!) with .SRM
|
||||
at the end. For example, the game "Super Mario All-Stars + World" has a rom name
|
||||
of "ALL_STARS + WORLD", so the SRAM file should have the name "ALL_STARS +
|
||||
WORLD.srm". You can see the rom name for a game by loading the game - the rom
|
||||
name is shown in the information that is briefly shown at the bottom of the
|
||||
screen. A perhaps easier way to find the correct name is simply to load the game
|
||||
and then save SRAM to SD or SMB and look at the filename that Snes9xGx uses.
|
||||
That's the name you should use when importing an SRAM from another platform.
|
||||
|
||||
To use an Snes9xGx SRAM on another platform just do the opposite: save SRAM to
|
||||
SD or SMB, and then copy that saved SRAM file to the other platform. You may
|
||||
have to rename the file to be what that version of snes9x expects it to be.
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· INJECTING A ROM ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
Injecting a rom is not required to use snes9xGx, but if you primarily use
|
||||
snes9xGx by streaming it to your cube you may wish to inject a rom into the dol.
|
||||
In that case the game will start playing immediately once Snes9xGx loads. If you
|
||||
have the auto-load SRAM option enabled it will load SRAM before starting the
|
||||
game as well.
|
||||
|
||||
To inject a rom you use the "inject.exe" tool on Windows or the "inject" tool on
|
||||
Mac OS X. This tool works at the command line and has syntax as follows:
|
||||
|
||||
inject original.dol gamerom.smc output.dol
|
||||
|
||||
On the Mac you will either need to copy the inject tool into a location that is
|
||||
in your "PATH" or just go into the directory that has the inject tool in it and
|
||||
proceed the command with "./" like this:
|
||||
|
||||
./inject original.dol gamerom.smc output.dol
|
||||
|
||||
Once you run the tool on your dol, just stream the outputted dol to your cube,
|
||||
or otherwise load it and Snes9xGx will load and the game will start running.
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· WAVEBIRD WIRELESS CONTROLLER ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
This note applies to all homebrew GC software. The Wavebird wireless controller
|
||||
CAN be used with homebrew, including Snes9xGx, but to enable it you must press a
|
||||
button on the controller when you power up the GC and see the Gamecube logo.
|
||||
This will initialize the controller and allow it to function in Snes9xGx and
|
||||
other homebrew software.
|
||||
|
||||
You must do this each time you power up your Gamecube. Also, if you unplug the
|
||||
wireless receiver while Snes9xGx is running and plug it back in, it will not
|
||||
work - you will then have to plug in a wired controller to continue play. Until
|
||||
someone figures out how to properly handle the Wavebird, this will continue to
|
||||
be the case. My ears are open!
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· SMB ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
TBD
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· CREDITS ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
Technical Credits
|
||||
|
||||
Snes9x v1.5.0/1.4.3 - Snes9x Team
|
||||
GameCube Port 2.0 WIP6 and earlier - SoftDev
|
||||
Additional improvements to 2.0 WIP6 - eke-eke
|
||||
GameCube 2.0.1bx enhancements - crunchy2
|
||||
>1.36 GB DVD reading on Wii - svpe
|
||||
GX - http://www.gc-linux.org
|
||||
Font - Qoob Team
|
||||
libogc - Shagkur
|
||||
|
||||
|
||||
Testing
|
||||
crunchy2 / tehskeen users / others
|
||||
|
||||
|
||||
Documentation
|
||||
original by brakken/updated by crunchy2
|
||||
|
||||
|
||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||
|0O×øo· SNES9XGX v2.0.1b8 ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
694
gu_psasm.S
Normal file
694
gu_psasm.S
Normal file
@ -0,0 +1,694 @@
|
||||
#include <asm.h>
|
||||
|
||||
#define A00_A01 fr0
|
||||
#define A02_A03 fr1
|
||||
#define A10_A11 fr2
|
||||
#define A12_A13 fr3
|
||||
#define A20_A21 fr4
|
||||
#define A22_A23 fr5
|
||||
|
||||
#define B00_B01 fr6
|
||||
#define B02_B03 fr7
|
||||
#define B10_B11 fr8
|
||||
#define B12_B13 fr9
|
||||
#define B20_B21 fr10
|
||||
#define B22_B23 fr11
|
||||
|
||||
#define D00_D01 fr12
|
||||
#define D02_D03 fr13
|
||||
#define D10_D11 fr14
|
||||
#define D12_D13 fr15
|
||||
#define D20_D21 fr2
|
||||
#define D22_D23 fr0
|
||||
|
||||
#define UNIT01 fr31
|
||||
|
||||
#define RET_REG fr1
|
||||
#define V1_XY fr2
|
||||
#define V1_Z fr3
|
||||
#define V2_XY fr4
|
||||
#define V2_Z fr5
|
||||
#define D1_XY fr6
|
||||
#define D1_Z fr7
|
||||
#define D2_XY fr8
|
||||
#define D2_Z fr9
|
||||
#define W1_XY fr10
|
||||
#define W1_Z fr11
|
||||
#define W2_XY fr12
|
||||
#define W2_Z fr13
|
||||
|
||||
.globl ps_guMtxConcat
|
||||
//r3 = mtxA, r4 = mtxB, r5 = mtxAB
|
||||
ps_guMtxConcat:
|
||||
stwu r1,-64(r1)
|
||||
psq_l A00_A01,0(r3),0,0
|
||||
stfd fr14,8(r1)
|
||||
psq_l B00_B01,0(r4),0,0
|
||||
lis r6,Unit01@ha
|
||||
psq_l B02_B03,8(r4),0,0
|
||||
stfd fr15,16(r1)
|
||||
addi 6,6,Unit01@l
|
||||
stfd fr31,40(r1)
|
||||
psq_l B10_B11,16(r4),0,0
|
||||
ps_muls0 D00_D01,B00_B01,A00_A01
|
||||
psq_l A10_A11,16(r3),0,0
|
||||
ps_muls0 D02_D03,B02_B03,A00_A01
|
||||
psq_l UNIT01,0(r6),0,0
|
||||
ps_muls0 D10_D11,B00_B01,A10_A11
|
||||
psq_l B12_B13,24(r4),0,0
|
||||
ps_muls0 D12_D13,B02_B03,A10_A11
|
||||
psq_l A02_A03,8(r3),0,0
|
||||
ps_madds1 D00_D01,B10_B11,A00_A01,D00_D01
|
||||
psq_l A12_A13,24(r3),0,0
|
||||
ps_madds1 D10_D11,B10_B11,A10_A11,D10_D11
|
||||
psq_l B20_B21,32(r4),0,0
|
||||
ps_madds1 D02_D03,B12_B13,A00_A01,D02_D03
|
||||
psq_l B22_B23,40(r4),0,0
|
||||
ps_madds1 D12_D13,B12_B13,A10_A11,D12_D13
|
||||
psq_l A20_A21,32(r3),0,0
|
||||
psq_l A22_A23,40(r3),0,0
|
||||
ps_madds0 D00_D01,B20_B21,A02_A03,D00_D01
|
||||
ps_madds0 D02_D03,B22_B23,A02_A03,D02_D03
|
||||
ps_madds0 D10_D11,B20_B21,A12_A13,D10_D11
|
||||
ps_madds0 D12_D13,B22_B23,A12_A13,D12_D13
|
||||
psq_st D00_D01,0(r5),0,0
|
||||
ps_muls0 D20_D21,B00_B01,A20_A21
|
||||
ps_madds1 D02_D03,UNIT01,A02_A03,D02_D03
|
||||
ps_muls0 D22_D23,B02_B03,A20_A21
|
||||
psq_st D10_D11,16(r5),0,0
|
||||
ps_madds1 D12_D13,UNIT01,A12_A13,D12_D13
|
||||
psq_st D02_D03,8(r5),0,0
|
||||
ps_madds1 D20_D21,B10_B11,A20_A21,D20_D21
|
||||
ps_madds1 D22_D23,B12_B13,A20_A21,D22_D23
|
||||
ps_madds0 D20_D21,B20_B21,A22_A23,D20_D21
|
||||
lfd fr14,8(r1)
|
||||
psq_st D12_D13,24(r5),0,0
|
||||
ps_madds0 D22_D23,B22_B23,A22_A23,D22_D23
|
||||
psq_st D20_D21,32(r5),0,0
|
||||
ps_madds1 D22_D23,UNIT01,A22_A23,D22_D23
|
||||
lfd fr15,16(r1)
|
||||
psq_st D22_D23,40(r5),0,0
|
||||
lfd fr31,40(r1)
|
||||
addi r1,r1,64
|
||||
blr
|
||||
|
||||
.globl ps_guMtxIdentity
|
||||
//r3 == mtx
|
||||
ps_guMtxIdentity:
|
||||
lis r9,Unit01@ha
|
||||
addi r9,r9,Unit01@l
|
||||
lfs fr0,0(r9)
|
||||
lfs fr1,4(r9)
|
||||
psq_st fr0,8(r3),0,0
|
||||
ps_merge01 fr2,fr0,fr1
|
||||
psq_st fr0,24(r3),0,0
|
||||
ps_merge10 fr3,fr1,fr0
|
||||
psq_st fr0,32(r3),0,0
|
||||
psq_st fr2,16(r3),0,0
|
||||
psq_st fr3,0(r3),0,0
|
||||
psq_st fr3,40(r3),0,0
|
||||
blr
|
||||
|
||||
.globl ps_guMtxCopy
|
||||
//r3 = src, r4 = dst
|
||||
ps_guMtxCopy:
|
||||
psq_l fr0,0(r3),0,0
|
||||
psq_st fr0,0(r4),0,0
|
||||
psq_l fr1,8(r3),0,0
|
||||
psq_st fr1,8(r4),0,0
|
||||
psq_l fr2,16(r3),0,0
|
||||
psq_st fr2,16(r4),0,0
|
||||
psq_l fr3,24(r3),0,0
|
||||
psq_st fr3,24(r4),0,0
|
||||
psq_l fr4,32(r3),0,0
|
||||
psq_st fr4,32(r4),0,0
|
||||
psq_l fr5,40(r3),0,0
|
||||
psq_st fr5,40(r4),0,0
|
||||
blr
|
||||
|
||||
.globl ps_guMtxTranspose
|
||||
//r3 = src, r4 = xpose
|
||||
ps_guMtxTranspose:
|
||||
lis r9,Unit01@ha
|
||||
addi r9,r9,Unit01@l
|
||||
lfs fr0,0(r9)
|
||||
psq_l fr1,0(r3),0,0
|
||||
stfs fr0,44(r4)
|
||||
psq_l fr2,16(r3),0,0
|
||||
ps_merge00 fr5,fr1,fr2
|
||||
psq_l fr3,8(r3),1,0
|
||||
ps_merge11 fr6,fr1,fr2
|
||||
psq_l fr4,24(r3),1,0
|
||||
psq_st fr5,0(r4),0,0
|
||||
psq_l fr1,32(r3),0,0
|
||||
ps_merge00 fr7,fr3,fr4
|
||||
psq_st fr6,16(r4),0,0
|
||||
ps_merge00 fr5,fr1,fr0
|
||||
psq_st fr7,32(r4),0,0
|
||||
ps_merge10 fr6,fr1,fr0
|
||||
psq_st fr5,8(r4),0,0
|
||||
lfs fr3,40(r3)
|
||||
psq_st fr6,24(r4),0,0
|
||||
stfs fr3,40(r4)
|
||||
blr
|
||||
|
||||
.globl ps_guMtxInverse
|
||||
//r3 = src, r4 = inv
|
||||
ps_guMtxInverse:
|
||||
psq_l fr0,0(r3),1,0
|
||||
psq_l fr1,4(r3),0,0
|
||||
psq_l fr2,16(r3),1,0
|
||||
ps_merge10 fr6,fr1,fr0
|
||||
psq_l fr3,20(r3),0,0
|
||||
psq_l fr4,32(r3),1,0
|
||||
ps_merge10 fr7,fr3,fr2
|
||||
psq_l fr5,36(r3),0,0
|
||||
ps_mul fr11,fr3,fr6
|
||||
ps_mul fr13,fr5,fr7
|
||||
ps_merge10 fr8,fr5,fr4
|
||||
ps_msub fr11,fr1,fr7,fr11
|
||||
ps_mul fr12,fr1,fr8
|
||||
ps_msub fr13,fr3,fr8,fr13
|
||||
ps_mul fr10,fr3,fr4
|
||||
ps_msub fr12,fr5,fr6,fr12
|
||||
ps_mul fr9,fr0,fr5
|
||||
ps_mul fr8,fr1,fr2
|
||||
ps_sub fr6,fr6,fr6
|
||||
ps_msub fr10,fr2,fr5,fr10
|
||||
ps_mul fr7,fr0,fr13
|
||||
ps_msub fr9,fr1,fr4,fr9
|
||||
ps_madd fr7,fr2,fr12,fr7
|
||||
ps_msub fr8,fr0,fr3,fr8
|
||||
ps_madd fr7,fr4,fr11,fr7
|
||||
ps_cmpo0 cr0,fr7,fr6
|
||||
bne 0f
|
||||
li r3,0
|
||||
blr
|
||||
|
||||
0: fres fr0,fr7
|
||||
ps_add fr6,fr0,fr0
|
||||
ps_mul fr5,fr0,fr0
|
||||
ps_nmsub fr0,fr7,fr5,fr6
|
||||
lfs fr1,12(r3)
|
||||
ps_muls0 fr13,fr13,fr0
|
||||
lfs fr2,28(r3)
|
||||
ps_muls0 fr12,fr12,fr0
|
||||
lfs fr3,44(r3)
|
||||
ps_muls0 fr11,fr11,fr0
|
||||
ps_merge00 fr5,fr13,fr12
|
||||
ps_muls0 fr10,fr10,fr0
|
||||
ps_merge11 fr4,fr13,fr12
|
||||
ps_muls0 fr9,fr9,fr0
|
||||
psq_st fr5,0(r4),0,0
|
||||
ps_mul fr6,fr13,fr1
|
||||
psq_st fr4,16(r4),0,0
|
||||
ps_muls0 fr8,fr8,fr0
|
||||
ps_madd fr6,fr12,fr2,fr6
|
||||
psq_st fr10,32(r4),1,0
|
||||
ps_nmadd fr6,fr11,fr3,fr6
|
||||
psq_st fr9,36(r4),1,0
|
||||
ps_mul fr7,fr10,fr1
|
||||
ps_merge00 fr5,fr11,fr6
|
||||
psq_st fr8,40(r4),1,0
|
||||
ps_merge11 fr4,fr11,fr6
|
||||
psq_st fr5,8(r4),0,0
|
||||
ps_madd fr7,fr9,fr2,fr7
|
||||
psq_st fr4,24(r4),0,0
|
||||
ps_nmadd fr7,fr8,fr3,fr7
|
||||
li r3,1
|
||||
psq_st fr7,44(r4),1,0
|
||||
blr
|
||||
|
||||
.globl ps_guMtxInvXpos
|
||||
//r3 = src, r4 = invx
|
||||
ps_guMtxInvXpos:
|
||||
psq_l fr0, 0(r3), 1, 0
|
||||
psq_l fr1, 4(r3), 0, 0
|
||||
psq_l fr2, 16(r3), 1, 0
|
||||
ps_merge10 fr6, fr1, fr0
|
||||
psq_l fr3, 20(r3), 0, 0
|
||||
psq_l fr4, 32(r3), 1, 0
|
||||
ps_merge10 fr7, fr3, fr2
|
||||
psq_l fr5, 36(r3), 0, 0
|
||||
ps_mul fr11, fr3, fr6
|
||||
ps_merge10 fr8, fr5, fr4
|
||||
ps_mul fr13, fr5, fr7
|
||||
ps_msub fr11, fr1, fr7, fr11
|
||||
ps_mul fr12, fr1, fr8
|
||||
ps_msub fr13, fr3, fr8, fr13
|
||||
ps_msub fr12, fr5, fr6, fr12
|
||||
ps_mul fr10, fr3, fr4
|
||||
ps_mul fr9, fr0, fr5
|
||||
ps_mul fr8, fr1, fr2
|
||||
ps_msub fr10, fr2, fr5, fr10
|
||||
ps_msub fr9, fr1, fr4, fr9
|
||||
ps_msub fr8, fr0, fr3, fr8
|
||||
ps_mul fr7, fr0, fr13
|
||||
ps_sub fr1, fr1, fr1
|
||||
ps_madd fr7, fr2, fr12, fr7
|
||||
ps_madd fr7, fr4, fr11, fr7
|
||||
ps_cmpo0 cr0, fr7, fr1
|
||||
bne 0f
|
||||
addi r3, 0, 0
|
||||
blr
|
||||
|
||||
0: fres fr0, fr7
|
||||
psq_st fr1, 12(r4), 1, 0
|
||||
ps_add fr6, fr0, fr0
|
||||
ps_mul fr5, fr0, fr0
|
||||
psq_st fr1, 28(r4), 1, 0
|
||||
ps_nmsub fr0, fr7, fr5, fr6
|
||||
psq_st fr1, 44(r4), 1, 0
|
||||
ps_muls0 fr13, fr13, fr0
|
||||
ps_muls0 fr12, fr12, fr0
|
||||
ps_muls0 fr11, fr11, fr0
|
||||
psq_st fr13, 0(r4), 0, 0
|
||||
psq_st fr12, 16(r4), 0, 0
|
||||
ps_muls0 fr10, fr10, fr0
|
||||
ps_muls0 fr9, fr9, fr0
|
||||
psq_st fr11, 32(r4), 0, 0
|
||||
psq_st fr10, 8(r4), 1, 0
|
||||
ps_muls0 fr8, fr8, fr0
|
||||
addi r3, 0, 1
|
||||
psq_st fr9, 24(r4), 1, 0
|
||||
psq_st fr8, 40(r4), 1, 0
|
||||
blr
|
||||
|
||||
.globl ps_guMtxScale
|
||||
//r3 = mtx,fr1 = xS,fr2 = yS,fr3 = zS
|
||||
ps_guMtxScale:
|
||||
lis r9,Unit01@ha
|
||||
addi r9,r9,Unit01@l
|
||||
lfs fr0,0(r9)
|
||||
stfs fr1,0(r3)
|
||||
psq_st fr0,4(r3),0,0
|
||||
psq_st fr0,12(r3),0,0
|
||||
stfs fr2,20(r3)
|
||||
psq_st fr0,24(r3),0,0
|
||||
psq_st fr0,32(r3),0,0
|
||||
stfs fr3,40(r3)
|
||||
stfs fr0,44(r3)
|
||||
blr
|
||||
|
||||
.globl ps_guMtxScaleApply
|
||||
//r3 = src,r4 = dst,fr1 = xS,fr2 = yS,fr3 = zS
|
||||
ps_guMtxScaleApply:
|
||||
psq_l fr4,0(r3),0,0
|
||||
psq_l fr5,8(r3),0,0
|
||||
ps_muls0 fr4,fr4,fr1
|
||||
psq_l fr6,16(r3),0,0
|
||||
ps_muls0 fr5,fr5,fr1
|
||||
psq_l fr7,24(r3),0,0
|
||||
ps_muls0 fr6,fr6,fr2
|
||||
psq_l fr8,32(r3),0,0
|
||||
psq_st fr4,0(r4),0,0
|
||||
ps_muls0 fr7,fr7,fr2
|
||||
psq_l fr2,40(r3),0,0
|
||||
psq_st fr5,8(r4),0,0
|
||||
ps_muls0 fr8,fr8,fr3
|
||||
psq_st fr6,16(r4),0,0
|
||||
ps_muls0 fr2,fr2,fr3
|
||||
psq_st fr7,24(r4),0,0
|
||||
psq_st fr8,32(r4),0,0
|
||||
psq_st fr2,40(r4),0,0
|
||||
blr
|
||||
|
||||
.globl ps_guMtxTrans
|
||||
//r3 = mtx,fr1 = xT,fr2 = yT,fr3 = zT
|
||||
ps_guMtxTrans:
|
||||
lis r9,Unit01@ha
|
||||
addi r9,r9,Unit01@l
|
||||
lfs fr4,0(r9)
|
||||
lfs fr5,4(r9)
|
||||
stfs fr1,12(r3)
|
||||
stfs fr2,28(r3)
|
||||
psq_st fr4,4(r3),0,0
|
||||
psq_st fr4,32(r3),0,0
|
||||
stfs fr5,20(r3)
|
||||
stfs fr4,24(r3)
|
||||
stfs fr5,40(r3)
|
||||
stfs fr3,44(r3)
|
||||
stfs fr5,0(r3)
|
||||
blr
|
||||
|
||||
.globl ps_guMtxTransApply
|
||||
//r3 = src,r4 = dst,fr1 = xT,fr2 = yT,fr3 = zT
|
||||
ps_guMtxTransApply:
|
||||
psq_l fr4,0(r3),0,0
|
||||
psq_l fr5,8(r3),0,0
|
||||
psq_l fr7,24(r3),0,0
|
||||
psq_l fr8,40(r3),0,0
|
||||
ps_sum1 fr5,fr1,fr5,fr5
|
||||
psq_l fr6,16(r3),0,0
|
||||
ps_sum1 fr7,fr2,fr7,fr7
|
||||
psq_l fr9,32(r3),0,0
|
||||
ps_sum1 fr8,fr3,fr8,fr8
|
||||
psq_st fr4,0(r4),0,0
|
||||
psq_st fr5,8(r4),0,0
|
||||
psq_st fr6,16(r4),0,0
|
||||
psq_st fr7,24(r4),0,0
|
||||
psq_st fr9,32(r4),0,0
|
||||
psq_st fr8,40(r4),0,0
|
||||
blr
|
||||
|
||||
.globl ps_guMtxRotTrig
|
||||
//r3 = mt,r4 = axis,fr1 = sinA,fr2 = cosA
|
||||
ps_guMtxRotTrig:
|
||||
lis r9,Unit01@ha
|
||||
addi r9,r9,Unit01@l
|
||||
lfs fr3,0(r9)
|
||||
lfs fr4,4(r9)
|
||||
ori r4,r4,0x20
|
||||
ps_neg fr5,fr1
|
||||
cmplwi r4,'x'
|
||||
beq 0f
|
||||
cmplwi r4,'y'
|
||||
beq 1f
|
||||
cmplwi r4,'z'
|
||||
beq 2f
|
||||
b 3f
|
||||
0:
|
||||
psq_st fr4,0(r3),1,0
|
||||
psq_st fr3,4(r3),0,0
|
||||
ps_merge00 fr6,fr1,fr2
|
||||
psq_st fr3,12(r3),0,0
|
||||
ps_merge00 fr7,fr2,fr5
|
||||
psq_st fr3,28(r3),0,0
|
||||
psq_st fr3,44(r3),1,0
|
||||
psq_st fr6,36(r3),0,0
|
||||
psq_st fr7,20(r3),0,0
|
||||
b 3f
|
||||
1:
|
||||
ps_merge00 fr6,fr2,fr3
|
||||
ps_merge00 fr7,fr3,fr4
|
||||
psq_st fr3,24(r3),0,0
|
||||
psq_st fr6,0(r3),0,0
|
||||
ps_merge00 fr8,fr5,fr3
|
||||
ps_merge00 fr9,fr1,fr3
|
||||
psq_st fr6,40(r3),0,0
|
||||
psq_st fr7,16(r3),0,0
|
||||
psq_st fr9,8(r3),0,0
|
||||
psq_st fr8,32(r3),0,0
|
||||
b 3f
|
||||
2:
|
||||
psq_st fr3,8(r3),0,0
|
||||
ps_merge00 fr6,fr1,fr2
|
||||
ps_merge00 fr8,fr2,fr5
|
||||
psq_st fr3,24(r3),0,0
|
||||
psq_st fr3,32(r3),0,0
|
||||
ps_merge00 fr7,fr4,fr3
|
||||
psq_st fr6,16(r3),0,0
|
||||
psq_st fr8,0(r3),0,0
|
||||
psq_st fr7,40(r3),0,0
|
||||
3:
|
||||
blr
|
||||
|
||||
.globl ps_guMtxReflect
|
||||
//r3 = mtx,r4 = vec1,r5 = vec2
|
||||
ps_guMtxReflect:
|
||||
lis r9,Unit01@ha
|
||||
addi r9,r9,Unit01@l
|
||||
lfs fr0,4(r9)
|
||||
psq_l fr1,8(r5),1,0
|
||||
psq_l fr2,0(r5),0,0
|
||||
psq_l fr3,0(r4),0,0
|
||||
ps_nmadd fr5,fr1,fr0,fr1
|
||||
psq_l fr4,8(r4),1,0
|
||||
ps_nmadd fr6,fr2,fr0,fr2
|
||||
ps_muls0 fr7,fr2,fr5
|
||||
ps_mul fr8,fr6,fr3
|
||||
ps_muls0 fr9,fr2,fr6
|
||||
ps_sum0 fr8,fr8,fr8,fr8
|
||||
ps_muls1 fr10,fr2,fr6
|
||||
psq_st fr7,32(r3),0,0
|
||||
ps_sum0 fr2,fr2,fr2,fr0
|
||||
ps_nmadd fr8,fr5,fr4,fr8
|
||||
ps_sum1 fr10,fr0,fr10,fr10
|
||||
psq_st fr9,0(r3),0,0
|
||||
ps_muls0 fr11,fr2,fr8
|
||||
ps_merge00 fr12,fr5,fr8
|
||||
psq_st fr10,16(r3),0,0
|
||||
ps_merge00 fr13,fr7,fr11
|
||||
ps_muls0 fr12,fr12,fr1
|
||||
ps_merge11 fr11,fr7,fr11
|
||||
psq_st fr13,8(r3),0,0
|
||||
ps_sum0 fr12,fr12,fr12,fr0
|
||||
psq_st fr11,24(r3),0,0
|
||||
psq_st fr12,40(r3),0,0
|
||||
blr
|
||||
|
||||
.globl ps_guVecAdd
|
||||
//r3 = v1,r4 = v2,r5 = dst
|
||||
ps_guVecAdd:
|
||||
psq_l V1_XY,0(r3),0,0
|
||||
psq_l V2_XY,0(r4),0,0
|
||||
ps_add D1_XY,V1_XY,V2_XY
|
||||
psq_st D1_XY,0(r5),0,0
|
||||
psq_l V1_Z,8(r3),1,0
|
||||
psq_l V2_Z,8(r4),1,0
|
||||
ps_add D1_Z,V1_Z,V2_Z
|
||||
psq_st D1_Z,8(r5),1,0
|
||||
blr
|
||||
|
||||
.globl ps_guVecSub
|
||||
//r3 = v1,r4 = v2,r5 = dst
|
||||
ps_guVecSub:
|
||||
psq_l V1_XY,0(r3),0,0
|
||||
psq_l V2_XY,0(r4),0,0
|
||||
ps_sub D1_XY,V1_XY,V2_XY
|
||||
psq_st D1_XY,0(r5),0,0
|
||||
psq_l V1_Z,8(r3),1,0
|
||||
psq_l V2_Z,8(r4),1,0
|
||||
ps_sub D1_Z,V1_Z,V2_Z
|
||||
psq_st D1_Z,8(r5),1,0
|
||||
blr
|
||||
|
||||
.globl ps_guVecScale
|
||||
//r3 = src,r4 = dst,fr1 = S
|
||||
ps_guVecScale:
|
||||
psq_l fr2,0(r3),0,0
|
||||
psq_l fr3,8(r3),1,0
|
||||
ps_muls0 fr4,fr2,fr1
|
||||
psq_st fr4,0(r4),0,0
|
||||
ps_muls0 fr4,fr3,fr1
|
||||
psq_st fr4,8(r4),1,0
|
||||
blr
|
||||
|
||||
.globl ps_guVecNormalize
|
||||
//r3 = v
|
||||
ps_guVecNormalize:
|
||||
lis r9,NrmData@ha
|
||||
addi r9,r9,NrmData@l
|
||||
lfs fr0,0(r9)
|
||||
lfs fr1,4(r9)
|
||||
psq_l fr2,0(r3),0,0
|
||||
ps_mul fr4,fr2,fr2
|
||||
psq_l fr3,8(r3),1,0
|
||||
ps_madd fr5,fr3,fr3,fr4
|
||||
ps_sum0 fr6,fr5,fr3,fr4
|
||||
frsqrte fr7,fr6
|
||||
fmuls fr8,fr7,fr7
|
||||
fmuls fr9,fr7,fr0
|
||||
fnmsubs fr8,fr8,fr6,fr1
|
||||
fmuls fr7,fr8,fr9
|
||||
ps_muls0 fr2,fr2,fr7
|
||||
psq_st fr2,0(r3),0,0
|
||||
ps_muls0 fr3,fr3,fr7
|
||||
psq_st fr3,8(r3),1,0
|
||||
blr
|
||||
|
||||
.globl ps_guVecCross
|
||||
//r3 = v1,r4 = v2,r5 = v12
|
||||
ps_guVecCross:
|
||||
psq_l fr1,0(r4),0,0
|
||||
lfs fr2,8(r3)
|
||||
psq_l fr0,0(r3),0,0
|
||||
ps_merge10 fr6,fr1,fr1
|
||||
lfs fr3,8(r4)
|
||||
ps_mul fr4,fr1,fr2
|
||||
ps_muls0 fr7,fr1,fr0
|
||||
ps_msub fr5,fr0,fr3,fr4
|
||||
ps_msub fr8,fr0,fr6,fr7
|
||||
ps_merge11 fr9,fr5,fr5
|
||||
ps_merge01 fr10,fr5,fr8
|
||||
psq_st fr9,0(r5),1,0
|
||||
ps_neg fr10,fr10
|
||||
psq_st fr10,4(r5),0,0
|
||||
blr
|
||||
|
||||
.globl ps_guVecDotProduct
|
||||
//r3 = vec1,r4 = vec2
|
||||
ps_guVecDotProduct:
|
||||
psq_l fr2,4(r3),0,0
|
||||
psq_l fr3,4(r4),0,0
|
||||
ps_mul fr2,fr2,fr3
|
||||
psq_l fr5,0(r3),0,0
|
||||
psq_l fr4,0(r4),0,0
|
||||
ps_madd fr3,fr5,fr4,fr2
|
||||
ps_sum0 fr1,fr3,fr2,fr2
|
||||
blr
|
||||
|
||||
.globl ps_guVecMultiply
|
||||
ps_guVecMultiply:
|
||||
psq_l fr0,0(r4),0,0
|
||||
psq_l fr2,0(r3),0,0
|
||||
psq_l fr1,8(r4),1,0
|
||||
ps_mul fr4,fr2,fr0
|
||||
psq_l fr3,8(r3),0,0
|
||||
ps_madd fr5,fr3,fr1,fr4
|
||||
psq_l fr8,16(r3),0,0
|
||||
ps_sum0 fr6,fr5,fr6,fr5
|
||||
psq_l fr9,24(r3),0,0
|
||||
ps_mul fr10,fr8,fr0
|
||||
psq_st fr6,0(r5),1,0
|
||||
ps_madd fr11,fr9,fr1,fr10
|
||||
psq_l fr2,32(r3),0,0
|
||||
ps_sum0 fr12,fr11,fr12,fr11
|
||||
psq_l fr3,40(r3),0,0
|
||||
ps_mul fr4,fr2,fr0
|
||||
psq_st fr12,4(r5),1,0
|
||||
ps_madd fr5,fr3,fr1,fr4
|
||||
ps_sum0 fr6,fr5,fr6,fr5
|
||||
psq_st fr6,8(r5),1,0
|
||||
blr
|
||||
|
||||
.globl ps_guVecMultiplySR
|
||||
// r3 = mt, r4 = src, r5 = dst
|
||||
ps_guVecMultiplySR:
|
||||
psq_l fr0,0(r3),0,0 // m[0][0], m[0][1] GQR0 = 0
|
||||
// fp6 - x y
|
||||
psq_l fr6,0(r4),0,0
|
||||
psq_l fr2,16(r3),0,0 // m[1][0], m[1][1]
|
||||
// fp8 = m00x m01y // next X
|
||||
ps_mul fr8,fr0,fr6
|
||||
psq_l fr4,32(r3),0,0 // m[2][0], m[2][1]
|
||||
// fp10 = m10x m11y // next Y
|
||||
ps_mul fr10,fr2,fr6
|
||||
psq_l fr7,8(r4),1,0 // fp7 - z,1.0
|
||||
// fp12 = m20x m21y // next Z
|
||||
ps_mul fr12,fr4,fr6 // YYY last FP6 usage
|
||||
psq_l fr3,24(r3),0,0 // m[1][2], m[1][3]
|
||||
ps_sum0 fr8,fr8,fr8,fr8
|
||||
psq_l fr5,40(r3),0,0 // m[2][2], m[2][3]
|
||||
ps_sum0 fr10,fr10,fr10,fr10
|
||||
psq_l fr1,8(r3),0,0 // m[0][2], m[0][3]
|
||||
ps_sum0 fr12,fr12,fr12,fr12
|
||||
ps_madd fr9,fr1,fr7,fr8
|
||||
psq_st fr9,0(r5),1,0 // store X
|
||||
ps_madd fr11,fr3,fr7,fr10
|
||||
psq_st fr11,4(r5),1,0 // store Y
|
||||
ps_madd fr13,fr5,fr7,fr12
|
||||
psq_st fr13,8(r5),1,0 // sore Z
|
||||
blr
|
||||
|
||||
.globl ps_guQuatAdd
|
||||
//r3 = a, r4 = b, r5 = ab
|
||||
ps_guQuatAdd:
|
||||
psq_l fr0,0(r3),0,0
|
||||
psq_l fr1,0(r4),0,0
|
||||
ps_add fr1,fr0,fr1
|
||||
psq_st fr1,0(r5),0,0
|
||||
psq_l fr0,8(r3),0,0
|
||||
psq_l fr1,8(r4),0,0
|
||||
ps_add fr1,fr0,fr1
|
||||
psq_st fr1,8(r5),0,0
|
||||
blr
|
||||
|
||||
.globl ps_guQuatSub
|
||||
//r3 = a, r4 = b, r5 = ab
|
||||
ps_guQuatSub:
|
||||
psq_l fr0,0(r3),0,0
|
||||
psq_l fr1,0(r4),0,0
|
||||
ps_sub fr1,fr0,fr1
|
||||
psq_st fr1,0(r5),0,0
|
||||
psq_l fr0,8(r3),0,0
|
||||
psq_l fr1,8(r4),0,0
|
||||
ps_sub fr1,fr0,fr1
|
||||
psq_st fr1,8(r5),0,0
|
||||
blr
|
||||
|
||||
.globl ps_guQuatMultiply
|
||||
//r3 = a, r4 = b, r5 = ab
|
||||
ps_guQuatMultiply:
|
||||
psq_l fr0,0(r3),0,0
|
||||
psq_l fr1,8(r3),0,0
|
||||
psq_l fr2,0(r4),0,0
|
||||
ps_neg fr4,fr0
|
||||
psq_l fr3,8(r4),0,0
|
||||
ps_neg fr5,fr1
|
||||
ps_merge01 fr6,fr4,fr0
|
||||
ps_muls0 fr8,fr1,fr2
|
||||
ps_muls0 fr9,fr4,fr2
|
||||
ps_merge01 fr7,fr5,fr1
|
||||
ps_muls1 fr11,fr6,fr2
|
||||
ps_madds0 fr8,fr6,fr3,fr8
|
||||
ps_muls1 fr10,fr7,fr2
|
||||
ps_madds0 fr9,fr7,fr3,fr9
|
||||
ps_madds1 fr11,fr5,fr3,fr11
|
||||
ps_merge10 fr8,fr8,fr8
|
||||
ps_madds1 fr10,fr0,fr3,fr10
|
||||
ps_merge10 fr9,fr9,fr9
|
||||
ps_add fr8,fr8,fr8
|
||||
psq_st fr8,0(r5),0,0
|
||||
ps_sub fr9,fr9,fr9
|
||||
psq_st fr9,8(r5),0,0
|
||||
blr
|
||||
|
||||
.globl ps_quQuatScale
|
||||
//r3 = q,r4 = r, fr1 = scale
|
||||
ps_guQuatScale:
|
||||
psq_l fr4,0(r3),0,0
|
||||
psq_l fr5,8(r3),0,0
|
||||
ps_muls0 fr4,fr4,fr1
|
||||
psq_st fr4,0(r4),0,0
|
||||
ps_muls0 fr5,fr5,fr1
|
||||
psq_st fr5,8(r4),0,0
|
||||
blr
|
||||
|
||||
.globl ps_guQuatDotProduct
|
||||
//r3 = p, r4 = q ; fr1 = res
|
||||
ps_guQuatDotProduct:
|
||||
psq_l fr2,0(r3),0,0
|
||||
psq_l fr4,0(r4),0,0
|
||||
ps_mul fr1,fr2,fr4
|
||||
psq_l fr3,8(r3),0,0
|
||||
psq_l fr5,8(r4),0,0
|
||||
ps_madd fr1,fr3,fr5,fr1
|
||||
ps_sum0 fr1,fr1,fr1,fr1
|
||||
blr
|
||||
|
||||
.globl ps_guQuatNormalize
|
||||
//r3 = src, r4 = unit
|
||||
ps_guQuatNormalize:
|
||||
lis r9,NrmData@ha
|
||||
addi r9,r9,NrmData@l
|
||||
lfs fr9,0(r9)
|
||||
lfs fr10,4(r9)
|
||||
lis r9,QuatEpsilon@ha
|
||||
lfs fr8,QuatEpsilon@l(r9)
|
||||
psq_l fr0,0(r3),0,0
|
||||
ps_mul fr2,fr0,fr0
|
||||
psq_l fr1,8(r3),0,0
|
||||
ps_sub fr5,fr8,fr8
|
||||
ps_madd fr2,fr2,fr2,fr2
|
||||
frsqrte fr3,fr2
|
||||
ps_sub fr4,fr2,fr8
|
||||
fmul fr6,fr3,fr3
|
||||
fmul fr7,fr3,fr9
|
||||
fnmsub fr6,fr6,fr2,fr10
|
||||
fmul fr3,fr6,fr7
|
||||
ps_sel fr3,fr4,fr3,fr5
|
||||
ps_muls0 fr0,fr0,fr3
|
||||
ps_muls0 fr1,fr1,fr3
|
||||
psq_st fr0,0(r4),0,0
|
||||
psq_st fr1,8(r4),0,0
|
||||
blr
|
||||
|
||||
.section .data
|
||||
.balign 4
|
||||
QuatEpsilon:
|
||||
.float 0.00001
|
||||
Unit01:
|
||||
.float 0.0, 1.0
|
||||
NrmData:
|
||||
.float 0.5, 3.0
|
4
inject/Makefile
Normal file
4
inject/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
inject.exe : inject.c
|
||||
@gcc -O2 -Wall inject.c -o inject.exe
|
||||
@strip inject.exe
|
||||
|
154
inject/inject.c
Normal file
154
inject/inject.c
Normal file
@ -0,0 +1,154 @@
|
||||
/****************************************************************************
|
||||
* Snes9x-GX 2.0
|
||||
*
|
||||
* Developer ROM injector.
|
||||
*
|
||||
* You should set ROMOFFSET to match aram.cpp, as this will change as the
|
||||
* binary expands and/or contracts.
|
||||
****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define DOLHEADERLENGTH 256 // GC DOL Header Length
|
||||
#define MAXTEXT 7 // Maximum 7 Text Sections
|
||||
#define MAXDATA 11 // Maximum 11 Data Sections
|
||||
|
||||
struct DOLHEADER{
|
||||
unsigned int textOffsets[MAXTEXT];
|
||||
unsigned int dataOffsets[MAXDATA];
|
||||
|
||||
unsigned int textAddress[MAXTEXT];
|
||||
unsigned int dataAddress[MAXDATA];
|
||||
|
||||
unsigned int textLength[MAXTEXT];
|
||||
unsigned int dataLength[MAXDATA];
|
||||
|
||||
unsigned int bssAddress;
|
||||
unsigned int bssLength;
|
||||
|
||||
unsigned int entryPoint;
|
||||
unsigned int unused[MAXTEXT];
|
||||
} dolheader;
|
||||
|
||||
unsigned int FLIP32(unsigned int b)
|
||||
{
|
||||
unsigned int c;
|
||||
|
||||
c = ( b & 0xff000000 ) >> 24;
|
||||
c |= ( b & 0xff0000 ) >> 8;
|
||||
c |= ( b & 0xff00 ) << 8;
|
||||
c |= ( b & 0xff ) << 24;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
#define ROMOFFSET 0x81000000
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE *infile, *outfile;
|
||||
char *dol;
|
||||
char *rom;
|
||||
int dollen, romlen, outlen;
|
||||
char *sig = "SNESROM0";
|
||||
|
||||
if ( argc != 4 )
|
||||
{
|
||||
printf("Usage : %s snes9xGx201.dol snesrom.smc output.dol\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*** Try to open all three handles ***/
|
||||
infile = fopen(argv[1], "rb");
|
||||
if ( infile == NULL )
|
||||
{
|
||||
printf("Unable to open %s for reading\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*** Allocate and load ***/
|
||||
fseek(infile, 0, SEEK_END);
|
||||
dollen=ftell(infile);
|
||||
fseek(infile, 0, SEEK_SET);
|
||||
|
||||
dol = calloc(sizeof(char), dollen + 32);
|
||||
|
||||
if ( fread(dol, 1, dollen, infile ) != dollen )
|
||||
{
|
||||
free(dol);
|
||||
printf("Error reading %s\n", argv[1]);
|
||||
fclose(infile);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
|
||||
infile = fopen(argv[2], "rb");
|
||||
if ( infile == NULL )
|
||||
{
|
||||
printf("Unable to open %s for reading\n", argv[2]);
|
||||
free(dol);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*** Allocate and load ***/
|
||||
fseek( infile, 0, SEEK_END);
|
||||
romlen = ftell(infile);
|
||||
fseek( infile, 0, SEEK_SET);
|
||||
rom = calloc( sizeof(char), romlen + 48 );
|
||||
|
||||
if ( fread(rom, 1, romlen, infile) != romlen )
|
||||
{
|
||||
printf("Error reading %s\n", argv[2]);
|
||||
fclose(infile);
|
||||
free(rom);
|
||||
free(dol);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
|
||||
/*** Ok, now have both in memory - so update the dol header and get this file done -;) ***/
|
||||
memcpy(&dolheader, dol, DOLHEADERLENGTH);
|
||||
|
||||
/*** Align to 32 bytes - no real reason, I just like it -;) ***/
|
||||
if ( dollen & 0x1f )
|
||||
dollen = ( dollen & ~0x1f ) + 0x20;
|
||||
|
||||
dolheader.dataOffsets[1] = FLIP32(dollen);
|
||||
dolheader.dataAddress[1] = FLIP32(ROMOFFSET);
|
||||
dolheader.dataLength[1] = FLIP32(romlen + 32);
|
||||
|
||||
/*** Move the updated header back ***/
|
||||
memcpy(dol, &dolheader, DOLHEADERLENGTH);
|
||||
|
||||
outfile = fopen(argv[3], "wb");
|
||||
if ( outfile == NULL )
|
||||
{
|
||||
printf("Unable to open %s for writing!\n", argv[3]);
|
||||
free(rom);
|
||||
free(dol);
|
||||
}
|
||||
|
||||
/*** Now simply update the files ***/
|
||||
fwrite(dol, 1, dollen, outfile);
|
||||
fwrite(sig, 1, 8, outfile);
|
||||
|
||||
outlen = FLIP32(romlen);
|
||||
fwrite(&outlen, 1, 4, outfile);
|
||||
|
||||
char align[32];
|
||||
memset(align, 0, 32);
|
||||
fwrite(align, 1, 20, outfile);
|
||||
fwrite(rom, 1, romlen, outfile);
|
||||
fclose(outfile);
|
||||
|
||||
free(dol);
|
||||
free(rom);
|
||||
|
||||
printf("Output file %s created successfully\n", argv[3]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
10
inject/make-inject
Normal file
10
inject/make-inject
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
#OS="macosx"
|
||||
OS="win32"
|
||||
#OS="linux"
|
||||
|
||||
echo Compiling inject.c for ${OS}...
|
||||
cp makefiles/Makefile-inject-${OS} Makefile
|
||||
make
|
||||
echo
|
4
inject/makefiles/Makefile-inject-linux
Normal file
4
inject/makefiles/Makefile-inject-linux
Normal file
@ -0,0 +1,4 @@
|
||||
inject.exe : inject.c
|
||||
@gcc -O2 -Wall inject.c -o inject
|
||||
@strip inject
|
||||
|
4
inject/makefiles/Makefile-inject-macosx
Normal file
4
inject/makefiles/Makefile-inject-macosx
Normal file
@ -0,0 +1,4 @@
|
||||
inject.exe : inject.c
|
||||
@gcc -O2 -arch i386 -arch ppc -Wall inject.c -o inject
|
||||
@strip inject
|
||||
|
4
inject/makefiles/Makefile-inject-win32
Normal file
4
inject/makefiles/Makefile-inject-win32
Normal file
@ -0,0 +1,4 @@
|
||||
inject.exe : inject.c
|
||||
@gcc -O2 -Wall inject.c -o inject.exe
|
||||
@strip inject.exe
|
||||
|
25
makeall
Normal file
25
makeall
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
touch source/ngc/snes9xGX.h
|
||||
cp makefiles/Makefile-mcslota Makefile
|
||||
make
|
||||
|
||||
touch source/ngc/snes9xGX.h
|
||||
cp makefiles/Makefile-sdslota Makefile
|
||||
make
|
||||
|
||||
touch source/ngc/snes9xGX.h
|
||||
cp makefiles/Makefile-sdslotb Makefile
|
||||
make
|
||||
|
||||
touch source/ngc/snes9xGX.h
|
||||
cp makefiles/Makefile-smb Makefile
|
||||
make
|
||||
|
||||
touch source/ngc/snes9xGX.h
|
||||
cp makefiles/Makefile-noload Makefile
|
||||
make
|
||||
|
||||
touch source/ngc/snes9xGX.h
|
||||
cp makefiles/Makefile-mcslotb Makefile
|
||||
make
|
179
makefiles/Makefile-mcslota
Normal file
179
makefiles/Makefile-mcslota
Normal file
@ -0,0 +1,179 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
# Generic makefile for Gamecube projects
|
||||
#
|
||||
# Tab stops set to 4
|
||||
# | | | |
|
||||
# 0 1 2 3
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := bin/snes9xGx201b8-mcslota
|
||||
BUILD := build
|
||||
SOURCES := source/snes9x source/unzip source/ngc source/smb
|
||||
INCLUDES := source/snes9x source/unzip source/ngc source/smb
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
||||
-DNGC -DNO_ASM -DCPU_SHUTDOWN -DSPC700C \
|
||||
-DSPC700_SHUTDOWN -DNEW_COLOUR_BLENDING \
|
||||
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
|
||||
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
|
||||
-DQUICK_SAVE_SLOT=0 \
|
||||
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
|
||||
-pipe
|
||||
|
||||
|
||||
LDFLAGS = $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||
|
||||
PREFIX := powerpc-gekko-
|
||||
|
||||
#export PATH:=/c/devkitPPC_r11/bin:/bin
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc -lm -lz -logcsys -lfreetype -lbba -lsdcard
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
run:
|
||||
psoload $(TARGET).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
reload:
|
||||
psoload -r $(TARGET).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
@echo output ... $(notdir $@)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
@echo linking ... $(notdir $@)
|
||||
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Compile Targets for C/C++
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.cpp
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.c
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.S
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.s
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
define bin2o
|
||||
cp $(<) $(*).tmp
|
||||
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
|
||||
--rename-section .data=.rodata,readonly,data,contents,alloc \
|
||||
--redefine-sym _binary_$*_tmp_start=$*\
|
||||
--redefine-sym _binary_$*_tmp_end=$*_end\
|
||||
--redefine-sym _binary_$*_tmp_size=$*_size\
|
||||
$(*).tmp $(@)
|
||||
echo "extern const u8" $(*)"[];" > $(*).h
|
||||
echo "extern const u32" $(*)_size[]";" >> $(*).h
|
||||
rm $(*).tmp
|
||||
endef
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
179
makefiles/Makefile-mcslotb
Normal file
179
makefiles/Makefile-mcslotb
Normal file
@ -0,0 +1,179 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
# Generic makefile for Gamecube projects
|
||||
#
|
||||
# Tab stops set to 4
|
||||
# | | | |
|
||||
# 0 1 2 3
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := bin/snes9xGx201b8-mcslotb
|
||||
BUILD := build
|
||||
SOURCES := source/snes9x source/unzip source/ngc source/smb
|
||||
INCLUDES := source/snes9x source/unzip source/ngc source/smb
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
||||
-DNGC -DNO_ASM -DCPU_SHUTDOWN -DSPC700C \
|
||||
-DSPC700_SHUTDOWN -DNEW_COLOUR_BLENDING \
|
||||
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
|
||||
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
|
||||
-DQUICK_SAVE_SLOT=1 \
|
||||
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
|
||||
-pipe
|
||||
|
||||
|
||||
LDFLAGS = $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||
|
||||
PREFIX := powerpc-gekko-
|
||||
|
||||
#export PATH:=/c/devkitPPC_r11/bin:/bin
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc -lm -lz -logcsys -lfreetype -lbba -lsdcard
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
run:
|
||||
psoload $(TARGET).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
reload:
|
||||
psoload -r $(TARGET).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
@echo output ... $(notdir $@)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
@echo linking ... $(notdir $@)
|
||||
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Compile Targets for C/C++
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.cpp
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.c
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.S
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.s
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
define bin2o
|
||||
cp $(<) $(*).tmp
|
||||
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
|
||||
--rename-section .data=.rodata,readonly,data,contents,alloc \
|
||||
--redefine-sym _binary_$*_tmp_start=$*\
|
||||
--redefine-sym _binary_$*_tmp_end=$*_end\
|
||||
--redefine-sym _binary_$*_tmp_size=$*_size\
|
||||
$(*).tmp $(@)
|
||||
echo "extern const u8" $(*)"[];" > $(*).h
|
||||
echo "extern const u32" $(*)_size[]";" >> $(*).h
|
||||
rm $(*).tmp
|
||||
endef
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
179
makefiles/Makefile-noload
Normal file
179
makefiles/Makefile-noload
Normal file
@ -0,0 +1,179 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
# Generic makefile for Gamecube projects
|
||||
#
|
||||
# Tab stops set to 4
|
||||
# | | | |
|
||||
# 0 1 2 3
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := bin/snes9xGx201b8-noload
|
||||
BUILD := build
|
||||
SOURCES := source/snes9x source/unzip source/ngc source/smb
|
||||
INCLUDES := source/snes9x source/unzip source/ngc source/smb
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
||||
-DNGC -DNO_ASM -DCPU_SHUTDOWN -DSPC700C \
|
||||
-DSPC700_SHUTDOWN -DNEW_COLOUR_BLENDING \
|
||||
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
|
||||
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
|
||||
-DQUICK_SAVE_SLOT=-1 \
|
||||
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
|
||||
-pipe
|
||||
|
||||
|
||||
LDFLAGS = $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||
|
||||
PREFIX := powerpc-gekko-
|
||||
|
||||
#export PATH:=/c/devkitPPC_r11/bin:/bin
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc -lm -lz -logcsys -lfreetype -lbba -lsdcard
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
run:
|
||||
psoload $(TARGET).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
reload:
|
||||
psoload -r $(TARGET).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
@echo output ... $(notdir $@)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
@echo linking ... $(notdir $@)
|
||||
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Compile Targets for C/C++
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.cpp
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.c
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.S
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.s
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
define bin2o
|
||||
cp $(<) $(*).tmp
|
||||
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
|
||||
--rename-section .data=.rodata,readonly,data,contents,alloc \
|
||||
--redefine-sym _binary_$*_tmp_start=$*\
|
||||
--redefine-sym _binary_$*_tmp_end=$*_end\
|
||||
--redefine-sym _binary_$*_tmp_size=$*_size\
|
||||
$(*).tmp $(@)
|
||||
echo "extern const u8" $(*)"[];" > $(*).h
|
||||
echo "extern const u32" $(*)_size[]";" >> $(*).h
|
||||
rm $(*).tmp
|
||||
endef
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
179
makefiles/Makefile-sdslota
Normal file
179
makefiles/Makefile-sdslota
Normal file
@ -0,0 +1,179 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
# Generic makefile for Gamecube projects
|
||||
#
|
||||
# Tab stops set to 4
|
||||
# | | | |
|
||||
# 0 1 2 3
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := bin/snes9xGx201b8-sdslota
|
||||
BUILD := build
|
||||
SOURCES := source/snes9x source/unzip source/ngc source/smb
|
||||
INCLUDES := source/snes9x source/unzip source/ngc source/smb
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
||||
-DNGC -DNO_ASM -DCPU_SHUTDOWN -DSPC700C \
|
||||
-DSPC700_SHUTDOWN -DNEW_COLOUR_BLENDING \
|
||||
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
|
||||
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
|
||||
-DQUICK_SAVE_SLOT=2 \
|
||||
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
|
||||
-pipe
|
||||
|
||||
|
||||
LDFLAGS = $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||
|
||||
PREFIX := powerpc-gekko-
|
||||
|
||||
#export PATH:=/c/devkitPPC_r11/bin:/bin
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc -lm -lz -logcsys -lfreetype -lbba -lsdcard
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
run:
|
||||
psoload $(TARGET).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
reload:
|
||||
psoload -r $(TARGET).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
@echo output ... $(notdir $@)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
@echo linking ... $(notdir $@)
|
||||
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Compile Targets for C/C++
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.cpp
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.c
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.S
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.s
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
define bin2o
|
||||
cp $(<) $(*).tmp
|
||||
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
|
||||
--rename-section .data=.rodata,readonly,data,contents,alloc \
|
||||
--redefine-sym _binary_$*_tmp_start=$*\
|
||||
--redefine-sym _binary_$*_tmp_end=$*_end\
|
||||
--redefine-sym _binary_$*_tmp_size=$*_size\
|
||||
$(*).tmp $(@)
|
||||
echo "extern const u8" $(*)"[];" > $(*).h
|
||||
echo "extern const u32" $(*)_size[]";" >> $(*).h
|
||||
rm $(*).tmp
|
||||
endef
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
179
makefiles/Makefile-sdslotb
Normal file
179
makefiles/Makefile-sdslotb
Normal file
@ -0,0 +1,179 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
# Generic makefile for Gamecube projects
|
||||
#
|
||||
# Tab stops set to 4
|
||||
# | | | |
|
||||
# 0 1 2 3
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := bin/snes9xGx201b8-sdslotb
|
||||
BUILD := build
|
||||
SOURCES := source/snes9x source/unzip source/ngc source/smb
|
||||
INCLUDES := source/snes9x source/unzip source/ngc source/smb
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
||||
-DNGC -DNO_ASM -DCPU_SHUTDOWN -DSPC700C \
|
||||
-DSPC700_SHUTDOWN -DNEW_COLOUR_BLENDING \
|
||||
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
|
||||
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
|
||||
-DQUICK_SAVE_SLOT=3 \
|
||||
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
|
||||
-pipe
|
||||
|
||||
|
||||
LDFLAGS = $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||
|
||||
PREFIX := powerpc-gekko-
|
||||
|
||||
#export PATH:=/c/devkitPPC_r11/bin:/bin
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc -lm -lz -logcsys -lfreetype -lbba -lsdcard
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
run:
|
||||
psoload $(TARGET).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
reload:
|
||||
psoload -r $(TARGET).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
@echo output ... $(notdir $@)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
@echo linking ... $(notdir $@)
|
||||
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Compile Targets for C/C++
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.cpp
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.c
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.S
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.s
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
define bin2o
|
||||
cp $(<) $(*).tmp
|
||||
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
|
||||
--rename-section .data=.rodata,readonly,data,contents,alloc \
|
||||
--redefine-sym _binary_$*_tmp_start=$*\
|
||||
--redefine-sym _binary_$*_tmp_end=$*_end\
|
||||
--redefine-sym _binary_$*_tmp_size=$*_size\
|
||||
$(*).tmp $(@)
|
||||
echo "extern const u8" $(*)"[];" > $(*).h
|
||||
echo "extern const u32" $(*)_size[]";" >> $(*).h
|
||||
rm $(*).tmp
|
||||
endef
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
188
makefiles/Makefile-smb
Normal file
188
makefiles/Makefile-smb
Normal file
@ -0,0 +1,188 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
# Generic makefile for Gamecube projects
|
||||
#
|
||||
# Tab stops set to 4
|
||||
# | | | |
|
||||
# 0 1 2 3
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := bin/snes9xGx201b8-smb
|
||||
BUILD := build
|
||||
SOURCES := source/snes9x source/unzip source/ngc source/smb
|
||||
INCLUDES := source/snes9x source/unzip source/ngc source/smb
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
||||
-DNGC -DNO_ASM -DCPU_SHUTDOWN -DSPC700C \
|
||||
-DSPC700_SHUTDOWN -DNEW_COLOUR_BLENDING \
|
||||
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
|
||||
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
|
||||
-DQUICK_SAVE_SLOT=4 \
|
||||
-DGC_IP='"192.168.1.32"' \
|
||||
-DGW_IP='"192.168.1.100"' \
|
||||
-DMASK='"255.255.255.0"' \
|
||||
-DSMB_USER='"Guest"' \
|
||||
-DSMB_PWD='"password"' \
|
||||
-DSMB_GCID='"gamecube"' \
|
||||
-DSMB_SVID='"mypc"' \
|
||||
-DSMB_SHARE='"gcshare"' \
|
||||
-DSMB_IP='"192.168.1.100"' \
|
||||
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
|
||||
-pipe
|
||||
|
||||
|
||||
LDFLAGS = $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||
|
||||
PREFIX := powerpc-gekko-
|
||||
|
||||
#export PATH:=/c/devkitPPC_r11/bin:/bin
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc -lm -lz -logcsys -lfreetype -lbba -lsdcard
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
run:
|
||||
psoload $(TARGET).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
reload:
|
||||
psoload -r $(TARGET).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
@echo output ... $(notdir $@)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
@echo linking ... $(notdir $@)
|
||||
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Compile Targets for C/C++
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.cpp
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.c
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -o $@ -c $<
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.S
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.s
|
||||
@echo Compiling ... $(notdir $<)
|
||||
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
define bin2o
|
||||
cp $(<) $(*).tmp
|
||||
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
|
||||
--rename-section .data=.rodata,readonly,data,contents,alloc \
|
||||
--redefine-sym _binary_$*_tmp_start=$*\
|
||||
--redefine-sym _binary_$*_tmp_end=$*_end\
|
||||
--redefine-sym _binary_$*_tmp_size=$*_size\
|
||||
$(*).tmp $(@)
|
||||
echo "extern const u8" $(*)"[];" > $(*).h
|
||||
echo "extern const u32" $(*)_size[]";" >> $(*).h
|
||||
rm $(*).tmp
|
||||
endef
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
77
source/ngc/aram.cpp
Normal file
77
source/ngc/aram.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Audio RAM
|
||||
*
|
||||
* softdev July 2006
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <string.h>
|
||||
#include "aram.h"
|
||||
|
||||
#define ARAM_READ 1
|
||||
#define ARAM_WRITE 0
|
||||
|
||||
#define TEMPSIZE 32768
|
||||
static char tempbuffer[TEMPSIZE] ATTRIBUTE_ALIGN (32);
|
||||
|
||||
/**
|
||||
* ARAMPut
|
||||
*
|
||||
* Move data from MAIN memory to ARAM
|
||||
*/
|
||||
void
|
||||
ARAMPut (char *src, char *dst, int len)
|
||||
{
|
||||
DCFlushRange (src, len);
|
||||
AR_StartDMA (ARAM_WRITE, (u32) src, (u32) dst, len);
|
||||
while (AR_GetDMAStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* ARAMFetch
|
||||
*
|
||||
* This function will move data from ARAM to MAIN memory
|
||||
*/
|
||||
void
|
||||
ARAMFetch (char *dst, char *src, int len)
|
||||
{
|
||||
DCInvalidateRange (dst, len);
|
||||
AR_StartDMA (ARAM_READ, (u32) dst, (u32) src, len);
|
||||
while (AR_GetDMAStatus ());
|
||||
}
|
||||
|
||||
/**
|
||||
* ARAMFetchSlow
|
||||
*
|
||||
* Required as SNES memory may NOT be 32-byte aligned
|
||||
*/
|
||||
void
|
||||
ARAMFetchSlow (char *dst, char *src, int len)
|
||||
{
|
||||
int t;
|
||||
|
||||
if (len > TEMPSIZE)
|
||||
{
|
||||
t = 0;
|
||||
while (t < len)
|
||||
{
|
||||
ARAMFetch (tempbuffer, src + t, TEMPSIZE);
|
||||
|
||||
if (t + TEMPSIZE > len)
|
||||
{
|
||||
memcpy (dst + t, tempbuffer, len - t);
|
||||
}
|
||||
else
|
||||
memcpy (dst + t, tempbuffer, TEMPSIZE);
|
||||
|
||||
t += TEMPSIZE;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ARAMFetch (tempbuffer, src, len);
|
||||
memcpy (dst, tempbuffer, len);
|
||||
}
|
||||
}
|
19
source/ngc/aram.h
Normal file
19
source/ngc/aram.h
Normal file
@ -0,0 +1,19 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Audio RAM
|
||||
*
|
||||
* softdev July 2006
|
||||
****************************************************************************/
|
||||
#ifndef _GCARAMI_
|
||||
|
||||
#define _GCARAMI_
|
||||
|
||||
#define AR_BACKDROP 0x8000
|
||||
#define AR_SNESROM 0x200000
|
||||
|
||||
void ARAMPut (char *src, char *dst, int len);
|
||||
void ARAMFetch (char *dst, char *src, int len);
|
||||
void ARAMFetchSlow (char *dst, char *src, int len);
|
||||
|
||||
#endif
|
104
source/ngc/audio.cpp
Normal file
104
source/ngc/audio.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Audio
|
||||
*
|
||||
* Audio is fixed to 32Khz/16bit/Stereo
|
||||
*
|
||||
* softdev July 2006
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "debug.h"
|
||||
#include "cpuexec.h"
|
||||
#include "ppu.h"
|
||||
#include "apu.h"
|
||||
#include "display.h"
|
||||
#include "gfx.h"
|
||||
#include "soundux.h"
|
||||
#include "spc700.h"
|
||||
#include "spc7110.h"
|
||||
#include "controls.h"
|
||||
|
||||
#include "video.h"
|
||||
#include "ftfont.h"
|
||||
|
||||
/*** Double buffered audio ***/
|
||||
#define AUDIOBUFFER 2048
|
||||
static unsigned char soundbuffer[2][AUDIOBUFFER]
|
||||
__attribute__ ((__aligned__ (32)));
|
||||
static int whichab = 0; /*** Audio buffer flip switch ***/
|
||||
extern int ConfigRequested;
|
||||
|
||||
#define AUDIOSTACK 16384
|
||||
lwpq_t audioqueue;
|
||||
lwp_t athread;
|
||||
static uint8 astack[AUDIOSTACK];
|
||||
|
||||
/**
|
||||
* Audio Threading
|
||||
*/
|
||||
static void *
|
||||
AudioThread (void *arg)
|
||||
{
|
||||
LWP_InitQueue (&audioqueue);
|
||||
|
||||
while (1)
|
||||
{
|
||||
whichab ^= 1;
|
||||
if (ConfigRequested)
|
||||
memset (soundbuffer[whichab], 0, AUDIOBUFFER);
|
||||
else
|
||||
{
|
||||
so.samples_mixed_so_far = so.play_position = 0;
|
||||
S9xMixSamples (soundbuffer[whichab], AUDIOBUFFER >> 1);
|
||||
}
|
||||
LWP_ThreadSleep (audioqueue);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* MixSamples
|
||||
* This continually calls S9xMixSamples On each DMA Completion
|
||||
*/
|
||||
static void
|
||||
GCMixSamples ()
|
||||
{
|
||||
AUDIO_StopDMA ();
|
||||
|
||||
DCFlushRange (soundbuffer[whichab], AUDIOBUFFER);
|
||||
AUDIO_InitDMA ((u32) soundbuffer[whichab], AUDIOBUFFER);
|
||||
AUDIO_StartDMA ();
|
||||
|
||||
LWP_ThreadSignal (audioqueue);
|
||||
}
|
||||
|
||||
/**
|
||||
* InitGCAudio
|
||||
*/
|
||||
void
|
||||
InitGCAudio ()
|
||||
{
|
||||
AUDIO_SetDSPSampleRate (AI_SAMPLERATE_32KHZ);
|
||||
AUDIO_RegisterDMACallback (GCMixSamples);
|
||||
|
||||
LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 80);
|
||||
}
|
||||
|
||||
/**
|
||||
* AudioStart
|
||||
*
|
||||
* Called to kick off the Audio Queue
|
||||
*/
|
||||
void
|
||||
AudioStart ()
|
||||
{
|
||||
GCMixSamples ();
|
||||
}
|
12
source/ngc/audio.h
Normal file
12
source/ngc/audio.h
Normal file
@ -0,0 +1,12 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Audio
|
||||
*
|
||||
* Audio is fixed to 32Khz/16bit/Stereo
|
||||
*
|
||||
* softdev July 2006
|
||||
****************************************************************************/
|
||||
|
||||
void InitGCAudio ();
|
||||
void AudioStart ();
|
877
source/ngc/dkpro.h
Normal file
877
source/ngc/dkpro.h
Normal file
@ -0,0 +1,877 @@
|
||||
/*******************************************************************
|
||||
* Image File : /public/dkpro.bmp
|
||||
* Width : 218
|
||||
* Height : 65
|
||||
*
|
||||
* This header contains a compressed Zip image.
|
||||
* Use zlib1.2.3 uncompress function to restore.
|
||||
*******************************************************************/
|
||||
|
||||
#define dkpro_RAW 28340
|
||||
#define dkpro_COMPRESSED 6887
|
||||
#define dkpro_WIDTH 218
|
||||
#define dkpro_HEIGHT 65
|
||||
|
||||
unsigned char dkpro[6887] = {
|
||||
0x78, 0xda, 0xed, 0x9c, 0x67, 0x70, 0x54, 0x57, 0x96, 0xc7, 0xf9, 0xb8,
|
||||
0xb5, 0x55, 0xbb, 0x55,
|
||||
0x53, 0xb5, 0xb5, 0xb3, 0x9e, 0x31, 0xc6, 0x98, 0x20, 0x31, 0xf6, 0x38,
|
||||
0x7b, 0xc6, 0x33, 0x0e,
|
||||
0xe3, 0x34, 0x60, 0x03, 0x36, 0xc9, 0x80, 0x49, 0xb6, 0x41, 0x42, 0x59,
|
||||
0x42, 0x39, 0x20, 0x75,
|
||||
0xbf, 0xd3, 0x92, 0x90, 0x84, 0x32, 0x41, 0x02, 0x11, 0xd4, 0x48, 0xe4,
|
||||
0x60, 0x72, 0x0e, 0x22,
|
||||
0x98, 0x8c, 0x8d, 0x04, 0x26, 0x83, 0x31, 0xe0, 0xec, 0x71, 0x06, 0xe7,
|
||||
0xa0, 0xfd, 0xdd, 0xdb,
|
||||
0xdd, 0xaf, 0x5f, 0xb7, 0xba, 0x07, 0x30, 0xc6, 0xf6, 0x87, 0xd6, 0xbf,
|
||||
0x1e, 0xb4, 0x6e, 0x38,
|
||||
0xf7, 0xe4, 0x7b, 0xee, 0x7b, 0x4f, 0xdd, 0x4e, 0xda, 0x5d, 0x1d, 0xaa,
|
||||
0xc3, 0x52, 0xba, 0x38,
|
||||
0x3b, 0x46, 0x75, 0x70, 0xb6, 0x8f, 0xbd, 0xb1, 0xfe, 0xc6, 0xf8, 0x3f,
|
||||
0x3a, 0x6f, 0x8c, 0x6f,
|
||||
0xef, 0xbc, 0x29, 0xb6, 0xa3, 0xb3, 0x53, 0x74, 0x57, 0x67, 0xb7, 0x88,
|
||||
0x76, 0x12, 0xc2, 0x6f,
|
||||
0x06, 0x55, 0xe1, 0xd8, 0xea, 0xe6, 0xa8, 0x3f, 0x38, 0xc3, 0x62, 0xfa,
|
||||
0xd5, 0x94, 0xc4, 0x2f,
|
||||
0x28, 0xdd, 0x91, 0x71, 0x74, 0xdc, 0xf9, 0xdc, 0x0b, 0x85, 0xa7, 0x72,
|
||||
0x0f, 0x8c, 0x5f, 0x95,
|
||||
0x59, 0x37, 0x29, 0x32, 0xf1, 0xfe, 0xfa, 0x3f, 0xc4, 0xb4, 0x77, 0x76,
|
||||
0x8a, 0x09, 0x9b, 0x15,
|
||||
0xb2, 0xdd, 0xaf, 0x6f, 0xaf, 0xb0, 0x94, 0x9b, 0x89, 0xa3, 0xbe, 0x93,
|
||||
0x9d, 0x09, 0xef, 0x39,
|
||||
0x5a, 0xed, 0xad, 0x12, 0x0c, 0x3f, 0xca, 0x8e, 0xca, 0x84, 0x94, 0xdb,
|
||||
0x9d, 0xed, 0xa3, 0xba,
|
||||
0x84, 0xec, 0xf6, 0x6b, 0xda, 0x2b, 0xf5, 0x26, 0x67, 0x58, 0x74, 0xe5,
|
||||
0xf8, 0x7f, 0x65, 0x6a,
|
||||
0xab, 0x18, 0xdf, 0x49, 0x50, 0x18, 0x3f, 0xb8, 0x6c, 0x37, 0x6e, 0x5d,
|
||||
0xee, 0xd3, 0x33, 0x6e,
|
||||
0x88, 0xeb, 0xec, 0xec, 0x16, 0x19, 0xd2, 0xe0, 0x2f, 0x9f, 0x0f, 0x3b,
|
||||
0xd4, 0xdf, 0x1b, 0x35,
|
||||
0xaf, 0xa8, 0x75, 0x6c, 0x2b, 0xf6, 0xf8, 0xc6, 0xf8, 0x46, 0x3c, 0xf8,
|
||||
0x9e, 0x98, 0xf2, 0x46,
|
||||
0xd7, 0x0f, 0xf2, 0xad, 0x78, 0xfb, 0xbe, 0x33, 0x68, 0xcd, 0x3f, 0x69,
|
||||
0x1b, 0x36, 0xfd, 0xa6,
|
||||
0xd8, 0x2e, 0xd5, 0xed, 0x52, 0x43, 0x9a, 0xfc, 0x85, 0x50, 0xdd, 0x2d,
|
||||
0xa5, 0xb3, 0xb3, 0x43,
|
||||
0x74, 0x69, 0x49, 0x6b, 0x76, 0xab, 0xf1, 0xb5, 0x7c, 0xa5, 0xa1, 0x6c,
|
||||
0xe5, 0xb2, 0xd3, 0x27,
|
||||
0x72, 0x52, 0xf6, 0xcb, 0x36, 0x69, 0x92, 0x5d, 0x72, 0x48, 0xde, 0x96,
|
||||
0x1f, 0xdc, 0xd6, 0xfb,
|
||||
0x56, 0xdc, 0x63, 0x0d, 0x6c, 0x5a, 0xb0, 0x3b, 0xef, 0xfe, 0xfa, 0x9b,
|
||||
0xa2, 0xc3, 0xab, 0xda,
|
||||
0xa5, 0x84, 0x34, 0x7a, 0xfd, 0xd1, 0xcd, 0xd9, 0x61, 0x74, 0x8f, 0xca,
|
||||
0x8f, 0x53, 0x5b, 0x8d,
|
||||
0xaf, 0xe4, 0x4b, 0x8d, 0x6f, 0xb0, 0xc9, 0xb7, 0x72, 0x5c, 0xe6, 0x48,
|
||||
0x86, 0x3c, 0x2b, 0x4f,
|
||||
0x4b, 0x5f, 0xe9, 0x2f, 0x03, 0x40, 0x7f, 0xe9, 0x27, 0x7d, 0xf8, 0x3d,
|
||||
0x5a, 0x2a, 0x65, 0x27,
|
||||
0xb6, 0x6c, 0xc5, 0xae, 0xae, 0x19, 0x5f, 0x2a, 0xbb, 0x95, 0x8c, 0xcf,
|
||||
0xea, 0xe8, 0x0c, 0x8b,
|
||||
0x0a, 0x69, 0xf4, 0x7a, 0xc7, 0x58, 0x58, 0xca, 0x1f, 0xa7, 0x94, 0x24,
|
||||
0xfd, 0x68, 0xff, 0x46,
|
||||
0x2e, 0x6a, 0x7c, 0x85, 0x25, 0x3e, 0x90, 0x06, 0x19, 0x8d, 0xb5, 0x06,
|
||||
0xcb, 0x70, 0x79, 0x41,
|
||||
0x5e, 0x6c, 0x83, 0x11, 0x32, 0x84, 0xde, 0x61, 0x32, 0x4e, 0x5e, 0xd5,
|
||||
0xd6, 0xbd, 0xa4, 0x67,
|
||||
0x5e, 0x22, 0x4f, 0x1e, 0x9a, 0x78, 0x4b, 0xca, 0xef, 0x9d, 0x37, 0x24,
|
||||
0xdd, 0xe0, 0xbc, 0x21,
|
||||
0x31, 0x74, 0x5d, 0xdb, 0xd5, 0xa1, 0xaa, 0x5d, 0x7a, 0x20, 0x9b, 0x85,
|
||||
0xcd, 0xea, 0x34, 0x7a,
|
||||
0x4d, 0x61, 0x6b, 0xee, 0xe7, 0xc6, 0x67, 0xf2, 0x99, 0x7c, 0x4e, 0xdc,
|
||||
0x9c, 0x93, 0x72, 0xe2,
|
||||
0x69, 0x08, 0x96, 0x19, 0x75, 0x19, 0x8c, 0xc4, 0x76, 0x03, 0x24, 0x81,
|
||||
0xac, 0xf9, 0x9d, 0x7c,
|
||||
0x21, 0x9f, 0x69, 0x7c, 0x65, 0x04, 0xaf, 0x34, 0x43, 0xb8, 0x3a, 0xac,
|
||||
0x99, 0xdc, 0x21, 0xb9,
|
||||
0x6d, 0xdd, 0xd1, 0x35, 0xb5, 0xc3, 0xc4, 0xe6, 0x94, 0xef, 0xed, 0x9f,
|
||||
0x88, 0xc2, 0x25, 0x62,
|
||||
0xac, 0x51, 0x86, 0x62, 0x89, 0xc8, 0xab, 0xc0, 0x48, 0x79, 0x4e, 0xc6,
|
||||
0xca, 0x19, 0xec, 0xf6,
|
||||
0xa9, 0x7c, 0x12, 0xc2, 0xcf, 0x05, 0xea, 0x8a, 0x39, 0x35, 0x1d, 0x92,
|
||||
0xda, 0xc6, 0x58, 0x97,
|
||||
0xc8, 0x23, 0xf2, 0x95, 0xfd, 0x43, 0x51, 0xf8, 0x42, 0x8e, 0x92, 0x0f,
|
||||
0x87, 0x73, 0x45, 0x5d,
|
||||
0x35, 0x46, 0x92, 0x45, 0x17, 0x90, 0x1d, 0x3f, 0x96, 0x0f, 0x43, 0xf8,
|
||||
0x79, 0x60, 0x7c, 0x21,
|
||||
0x8d, 0x35, 0x37, 0x27, 0xf9, 0xd7, 0xf6, 0xed, 0x27, 0xee, 0x4e, 0xbd,
|
||||
0x64, 0x7f, 0x5f, 0xde,
|
||||
0x67, 0xff, 0xfa, 0x5a, 0x56, 0x90, 0x0d, 0x47, 0x4b, 0xec, 0x4f, 0x44,
|
||||
0x8c, 0x3c, 0x2f, 0x42,
|
||||
0xa4, 0xaa, 0x5a, 0x32, 0x84, 0x6b, 0xc3, 0x87, 0x58, 0xe4, 0x7d, 0xe3,
|
||||
0x73, 0x69, 0xf0, 0xb3,
|
||||
0x99, 0xaa, 0x15, 0xe7, 0x17, 0x7c, 0x99, 0xf7, 0xae, 0xbc, 0x2b, 0xef,
|
||||
0x11, 0x8b, 0x33, 0x89,
|
||||
0xb0, 0x38, 0x89, 0xbf, 0x26, 0x44, 0x63, 0x37, 0xb5, 0xcb, 0x85, 0x70,
|
||||
0x2d, 0x18, 0x28, 0x47,
|
||||
0x88, 0xa1, 0x77, 0x8d, 0x4f, 0xc5, 0xe9, 0x67, 0xb3, 0x9b, 0xa7, 0x66,
|
||||
0xc4, 0x7d, 0x61, 0x7f,
|
||||
0xdb, 0xf1, 0x16, 0xe7, 0xad, 0xcf, 0x64, 0xaa, 0x44, 0x48, 0xa2, 0x24,
|
||||
0x5d, 0x33, 0x12, 0x43,
|
||||
0xb8, 0x66, 0x8c, 0x94, 0x63, 0xc4, 0xd1, 0x5b, 0xc6, 0x47, 0x52, 0x6f,
|
||||
0xb5, 0x59, 0x75, 0x97,
|
||||
0xd4, 0xbf, 0x95, 0x5f, 0x4c, 0xbf, 0x60, 0x9c, 0x97, 0xf3, 0xd8, 0x74,
|
||||
0x16, 0x95, 0x44, 0x4a,
|
||||
0x08, 0xbf, 0x11, 0x44, 0xc9, 0x6b, 0xf2, 0x96, 0x9c, 0x37, 0x3e, 0x90,
|
||||
0xe9, 0x35, 0x1d, 0x4d,
|
||||
0x9b, 0x85, 0x3b, 0x3b, 0x8e, 0xde, 0xe6, 0x78, 0xdb, 0x7e, 0x56, 0xce,
|
||||
0x62, 0xd1, 0xd5, 0xec,
|
||||
0x46, 0x69, 0x57, 0x81, 0x74, 0x13, 0x69, 0xd7, 0x1d, 0xe9, 0x57, 0xb9,
|
||||
0x5a, 0xaa, 0xbe, 0x52,
|
||||
0xaf, 0x61, 0x95, 0xf4, 0x5f, 0x54, 0xbe, 0x40, 0x88, 0x91, 0x43, 0x44,
|
||||
0xd2, 0x59, 0xe3, 0x5d,
|
||||
0x99, 0x66, 0xb1, 0xd9, 0x2d, 0x75, 0xa9, 0x71, 0x1f, 0xd8, 0x4f, 0x3b,
|
||||
0x4e, 0xcb, 0x1b, 0xd2,
|
||||
0xcc, 0xf9, 0x2a, 0x53, 0xb2, 0xae, 0x10, 0x99, 0x3e, 0x92, 0xa4, 0x4b,
|
||||
0xc6, 0x15, 0xcf, 0xbc,
|
||||
0x7a, 0x64, 0xfa, 0x69, 0x2d, 0xfd, 0xdf, 0xf2, 0x99, 0x89, 0xa5, 0xd4,
|
||||
0x8e, 0xea, 0xaa, 0x63,
|
||||
0xa3, 0xf1, 0xc3, 0x64, 0x66, 0x5c, 0xfd, 0x2a, 0x69, 0x7e, 0xf2, 0x65,
|
||||
0x5e, 0x47, 0x09, 0x03,
|
||||
0x23, 0x41, 0x0e, 0x12, 0x4b, 0xa7, 0x8d, 0x37, 0x65, 0xaa, 0xc7, 0x66,
|
||||
0xd4, 0x8b, 0xb7, 0x54,
|
||||
0x9d, 0x4d, 0x3f, 0x65, 0x9c, 0x90, 0x93, 0xf4, 0x8d, 0x83, 0xab, 0xb1,
|
||||
0x57, 0x88, 0x2c, 0x19,
|
||||
0x23, 0x2f, 0xc8, 0x30, 0xce, 0xdb, 0x0a, 0xc3, 0xa9, 0x33, 0xd3, 0x25,
|
||||
0xfb, 0x8a, 0x67, 0x5f,
|
||||
0x1d, 0x72, 0xd0, 0x57, 0x2c, 0x27, 0xc5, 0xa1, 0xe6, 0x6a, 0xa3, 0x69,
|
||||
0xc9, 0x09, 0x3a, 0x3e,
|
||||
0x93, 0x9d, 0x40, 0x5d, 0xb1, 0x54, 0x52, 0xb1, 0x58, 0x2f, 0x8d, 0x2c,
|
||||
0x93, 0xa6, 0xc7, 0xe7,
|
||||
0xc0, 0xa3, 0xb2, 0x4d, 0x86, 0x86, 0xb2, 0x81, 0x97, 0xe7, 0x6c, 0x2c,
|
||||
0xfd, 0xa2, 0x29, 0x91,
|
||||
0x15, 0x43, 0x59, 0xf1, 0x79, 0xf6, 0x0c, 0x65, 0xfb, 0x8c, 0xeb, 0x26,
|
||||
0x65, 0x20, 0x24, 0xcb,
|
||||
0x2b, 0x72, 0x5a, 0x4e, 0xb0, 0x6f, 0xd5, 0xd6, 0xba, 0x6c, 0xd6, 0x6d,
|
||||
0x56, 0xc7, 0x48, 0x5b,
|
||||
0xd1, 0xf9, 0x9c, 0x23, 0x54, 0x27, 0xa7, 0x39, 0x53, 0x65, 0x88, 0xed,
|
||||
0x8a, 0xa1, 0xfc, 0x6e,
|
||||
0xbf, 0x6c, 0x91, 0xcd, 0x1a, 0x4d, 0xf2, 0x2a, 0x3a, 0xcd, 0x11, 0xfb,
|
||||
0x55, 0x50, 0xb8, 0x72,
|
||||
0xe4, 0xa2, 0x77, 0xa7, 0xec, 0x34, 0x57, 0xdb, 0x2e, 0x6b, 0xa9, 0x93,
|
||||
0xc6, 0x06, 0x1d, 0x9f,
|
||||
0x49, 0x74, 0xf9, 0xde, 0x45, 0xa8, 0x46, 0xe3, 0x36, 0xb8, 0xcb, 0xc1,
|
||||
0xd3, 0x46, 0x70, 0xee,
|
||||
0x1f, 0xa4, 0x31, 0x84, 0x3d, 0x3e, 0x03, 0xea, 0x36, 0xdd, 0x97, 0xc9,
|
||||
0x2a, 0x07, 0x90, 0x64,
|
||||
0x73, 0x1b, 0x34, 0xc9, 0x4a, 0x99, 0x27, 0xe5, 0xd8, 0x7d, 0x04, 0x67,
|
||||
0xcf, 0x04, 0x2c, 0x9d,
|
||||
0x7b, 0x5d, 0xe4, 0x0c, 0xa4, 0xe5, 0xfd, 0x72, 0x5c, 0x8e, 0x18, 0x67,
|
||||
0x64, 0xb2, 0x3b, 0xce,
|
||||
0xc2, 0x9d, 0x5d, 0x22, 0x0f, 0x18, 0x47, 0x8c, 0x43, 0x72, 0x98, 0xbd,
|
||||
0x6e, 0xac, 0x18, 0x72,
|
||||
0xa5, 0x3f, 0x06, 0x3e, 0x99, 0xe2, 0xa7, 0x97, 0xdb, 0xd0, 0xc8, 0xf5,
|
||||
0xf9, 0xb1, 0xa1, 0xdb,
|
||||
0x26, 0x9f, 0xb5, 0xde, 0x94, 0x87, 0xd0, 0x72, 0xb0, 0x9f, 0x4c, 0xa2,
|
||||
0xe2, 0x0b, 0xf9, 0xc1,
|
||||
0x7c, 0xbe, 0xd7, 0x0a, 0xb7, 0x23, 0x34, 0xd7, 0x69, 0x52, 0x88, 0x77,
|
||||
0x36, 0xbb, 0x71, 0x48,
|
||||
0x5a, 0x88, 0x44, 0x97, 0xdc, 0x06, 0xd6, 0x7b, 0xfe, 0xb2, 0x77, 0x90,
|
||||
0xbe, 0xc6, 0xaa, 0xd1,
|
||||
0xc4, 0x62, 0x16, 0x3c, 0xfd, 0x12, 0x3f, 0x59, 0xb2, 0x07, 0xcb, 0x1c,
|
||||
0x32, 0x4e, 0xca, 0xc4,
|
||||
0x9a, 0x8e, 0x89, 0xca, 0x66, 0x9d, 0xa7, 0x45, 0xc4, 0xbe, 0x6e, 0x6f,
|
||||
0x76, 0x34, 0x13, 0x67,
|
||||
0x0d, 0x70, 0x5d, 0x70, 0x85, 0x28, 0xe4, 0x4a, 0xc3, 0x2b, 0x5b, 0x3d,
|
||||
0xf7, 0xf1, 0x41, 0xab,
|
||||
0xfc, 0x51, 0xf2, 0xe8, 0x29, 0xbc, 0x62, 0x2a, 0x57, 0xbe, 0x9a, 0x90,
|
||||
0xb3, 0x56, 0xc9, 0x8f,
|
||||
0xe6, 0x5a, 0xdf, 0xc9, 0x51, 0xb9, 0x5b, 0xf2, 0x03, 0xae, 0xa5, 0xda,
|
||||
0x72, 0xb0, 0xd0, 0xa7,
|
||||
0xe8, 0xd7, 0xcb, 0x9b, 0xca, 0xe3, 0xaa, 0x27, 0x85, 0x59, 0xea, 0xf9,
|
||||
0x83, 0x0b, 0xad, 0x9c,
|
||||
0xfb, 0x9f, 0xc0, 0x66, 0x8a, 0xeb, 0x7c, 0xf4, 0x33, 0xd8, 0x47, 0xa2,
|
||||
0x40, 0xf8, 0x5a, 0x3f,
|
||||
0x7b, 0x9a, 0x43, 0x8c, 0x8e, 0x15, 0xc7, 0xcf, 0x2e, 0x69, 0x5b, 0xe4,
|
||||
0xc9, 0x6e, 0xfc, 0xaa,
|
||||
0xd9, 0x38, 0x26, 0xd5, 0x6e, 0x9b, 0xdd, 0x34, 0x71, 0x69, 0x6a, 0x8b,
|
||||
0x71, 0x80, 0x9c, 0xb9,
|
||||
0x5f, 0x8a, 0xd8, 0xcd, 0x8a, 0x2e, 0x8b, 0x62, 0xa0, 0xfe, 0x1d, 0xa7,
|
||||
0x33, 0x49, 0xab, 0x7c,
|
||||
0x6e, 0xa2, 0x55, 0xda, 0xe3, 0xf9, 0x81, 0x66, 0x78, 0xe7, 0xfd, 0x34,
|
||||
0x14, 0xc3, 0xfb, 0x48,
|
||||
0x59, 0x21, 0xdf, 0x9a, 0x6b, 0x7d, 0x45, 0x5e, 0xb8, 0x87, 0xd6, 0x60,
|
||||
0x34, 0xf3, 0xc8, 0x9c,
|
||||
0x1f, 0x11, 0x69, 0x17, 0xdd, 0x50, 0x36, 0x8b, 0xd0, 0x12, 0xa6, 0xd0,
|
||||
0xe7, 0xe5, 0xfa, 0x12,
|
||||
0x67, 0x9b, 0xfb, 0x89, 0x98, 0x22, 0xdd, 0x97, 0x43, 0xae, 0xb4, 0x4a,
|
||||
0x14, 0x1c, 0xad, 0x64,
|
||||
0xea, 0x61, 0x78, 0xd2, 0xb8, 0x9f, 0x20, 0x4b, 0xb1, 0x45, 0x2b, 0x97,
|
||||
0x87, 0x21, 0x3b, 0xd8,
|
||||
0x75, 0x0e, 0x18, 0x87, 0xa5, 0xb2, 0x16, 0x9b, 0x55, 0x87, 0xa5, 0xdc,
|
||||
0x56, 0x71, 0x32, 0x75,
|
||||
0xaf, 0xec, 0x25, 0xde, 0x97, 0xb2, 0x7e, 0x69, 0x50, 0x94, 0x81, 0x52,
|
||||
0x19, 0x2f, 0x25, 0x7a,
|
||||
0xad, 0x12, 0x3e, 0x95, 0x92, 0xd1, 0x93, 0xd0, 0xa2, 0xf7, 0x9e, 0x58,
|
||||
0xab, 0x74, 0x44, 0x8b,
|
||||
0xae, 0x91, 0xbe, 0x33, 0xc6, 0xb9, 0x65, 0x73, 0xcd, 0xf3, 0x8c, 0x08,
|
||||
0xbe, 0x8e, 0xff, 0x88,
|
||||
0x32, 0x68, 0x44, 0xc1, 0xe1, 0x25, 0x73, 0xad, 0xcf, 0x90, 0xe3, 0x7e,
|
||||
0xe8, 0x05, 0xa3, 0x95,
|
||||
0x0f, 0x6f, 0xff, 0x72, 0x3f, 0x13, 0x72, 0xd9, 0x4c, 0xd5, 0x91, 0x6a,
|
||||
0x6c, 0x06, 0x36, 0xfb,
|
||||
0xc6, 0xa4, 0xf3, 0x09, 0x67, 0x9f, 0x07, 0xd0, 0xbd, 0x8b, 0x8a, 0x8d,
|
||||
0x4a, 0xe3, 0xfb, 0x2b,
|
||||
0xbc, 0x03, 0xf8, 0x23, 0xd6, 0xcf, 0x80, 0x83, 0xc0, 0x72, 0x28, 0xb9,
|
||||
0x95, 0xb4, 0xe3, 0x03,
|
||||
0x68, 0xa3, 0xc8, 0xad, 0x8f, 0x62, 0xb7, 0x36, 0x4a, 0xff, 0x8d, 0x3e,
|
||||
0x4a, 0x89, 0xff, 0x6d,
|
||||
0xb2, 0x4f, 0xf6, 0x1a, 0xcd, 0x52, 0xae, 0x6a, 0x90, 0xea, 0xce, 0xa9,
|
||||
0x11, 0x25, 0xcd, 0x59,
|
||||
0x3b, 0xd9, 0xdb, 0xf7, 0x4b, 0x0d, 0x3b, 0x6c, 0x45, 0x10, 0x54, 0x72,
|
||||
0x95, 0xb3, 0x82, 0x50,
|
||||
0x31, 0x25, 0xe3, 0xb1, 0x69, 0xd8, 0xab, 0x10, 0xaf, 0x4c, 0x42, 0x2b,
|
||||
0xef, 0x9a, 0xf8, 0x5e,
|
||||
0x6e, 0x81, 0x97, 0x4a, 0x0d, 0x35, 0xab, 0x4c, 0x7b, 0x49, 0x26, 0xe3,
|
||||
0xe3, 0x75, 0xed, 0x36,
|
||||
0x86, 0xdc, 0x63, 0xc0, 0x69, 0x99, 0x9b, 0x66, 0x39, 0x1c, 0x15, 0x61,
|
||||
0xe5, 0x7c, 0x33, 0xa7,
|
||||
0x95, 0x68, 0x1e, 0x5c, 0xab, 0x95, 0x40, 0xcb, 0xd3, 0x33, 0x8e, 0xbe,
|
||||
0x18, 0x59, 0x2c, 0x1f,
|
||||
0x9b, 0x6b, 0x7d, 0x88, 0x9f, 0xfd, 0x4d, 0x53, 0x2a, 0x63, 0x64, 0xa1,
|
||||
0x39, 0x32, 0x9f, 0xb1,
|
||||
0xc5, 0x9a, 0xd7, 0x6c, 0xe9, 0x21, 0x37, 0x49, 0x07, 0x8d, 0x9b, 0xc1,
|
||||
0x7d, 0xd8, 0x4a, 0x71,
|
||||
0xa4, 0xb8, 0xb8, 0x68, 0xd2, 0x79, 0x5f, 0xce, 0xc9, 0x5f, 0x90, 0x64,
|
||||
0x9c, 0x5e, 0x5b, 0xd8,
|
||||
0xcf, 0xbe, 0xb4, 0x48, 0xa4, 0x70, 0xc9, 0x8d, 0x4f, 0xf1, 0x01, 0x6b,
|
||||
0xfb, 0x47, 0xb2, 0x4b,
|
||||
0x06, 0x6a, 0x69, 0x8a, 0xcd, 0xf5, 0x0b, 0xa1, 0x5f, 0xaa, 0xa5, 0xb2,
|
||||
0xe9, 0x3a, 0x3d, 0x9f,
|
||||
0xcf, 0x15, 0xa6, 0x36, 0x4a, 0xdc, 0xfa, 0x8b, 0xd7, 0x77, 0x64, 0x93,
|
||||
0xa8, 0x2e, 0x6c, 0x3a,
|
||||
0x4e, 0xca, 0x4d, 0x8d, 0x05, 0x42, 0x09, 0x75, 0xd7, 0x2e, 0xd9, 0x49,
|
||||
0x2e, 0x2c, 0xad, 0xb9,
|
||||
0x25, 0x91, 0x9a, 0x71, 0x74, 0x4d, 0xc1, 0xee, 0xbc, 0xed, 0x54, 0x61,
|
||||
0x5b, 0x99, 0x39, 0x31,
|
||||
0x28, 0x26, 0x40, 0x73, 0x1c, 0xd2, 0xa6, 0xf0, 0x79, 0x31, 0x15, 0x54,
|
||||
0x23, 0xdc, 0xc4, 0xea,
|
||||
0x3a, 0xfa, 0x23, 0x64, 0xf6, 0xe0, 0x92, 0x74, 0x41, 0x57, 0xae, 0xf1,
|
||||
0x55, 0x7c, 0xca, 0x65,
|
||||
0x44, 0x3a, 0xf5, 0xda, 0x22, 0xd9, 0x48, 0xfd, 0xb0, 0x89, 0x99, 0x55,
|
||||
0x50, 0x88, 0x25, 0x7f,
|
||||
0x96, 0xd2, 0xaa, 0xc6, 0x14, 0xf3, 0x39, 0x85, 0x2a, 0x4c, 0x21, 0x09,
|
||||
0xaf, 0x55, 0x3d, 0x13,
|
||||
0x98, 0x5f, 0x05, 0xa7, 0x79, 0xcc, 0x4d, 0xd4, 0x3d, 0x63, 0xb0, 0xbb,
|
||||
0xb0, 0xef, 0x2f, 0x40,
|
||||
0x53, 0x9e, 0xb5, 0xde, 0x26, 0x63, 0x3c, 0xc4, 0xb8, 0x4a, 0xf4, 0x94,
|
||||
0x61, 0xd2, 0x48, 0xe4,
|
||||
0xd3, 0x58, 0xb4, 0x53, 0xae, 0xf5, 0x1f, 0x47, 0x75, 0x38, 0x50, 0x9e,
|
||||
0x05, 0x83, 0xb0, 0x45,
|
||||
0xaa, 0xf6, 0xef, 0x5c, 0x72, 0x6c, 0x16, 0xda, 0xf7, 0xd0, 0xb9, 0xc0,
|
||||
0x09, 0xe7, 0x2f, 0xd0,
|
||||
0xce, 0x40, 0xa2, 0x32, 0x68, 0x8d, 0xc4, 0x2f, 0xce, 0x59, 0xf0, 0x31,
|
||||
0x19, 0x55, 0xdd, 0x8d,
|
||||
0x48, 0x86, 0xaf, 0x3d, 0x96, 0x79, 0x0a, 0x5f, 0xca, 0x3f, 0xb1, 0x93,
|
||||
0xb2, 0x4f, 0xaa, 0x7b,
|
||||
0xfd, 0x64, 0x5d, 0x83, 0xd9, 0xb0, 0x4a, 0xae, 0x4c, 0x41, 0xee, 0x32,
|
||||
0x56, 0x74, 0xc9, 0x53,
|
||||
0x8a, 0xb7, 0xc6, 0xe1, 0xeb, 0x65, 0x48, 0xb1, 0x01, 0x2b, 0x6c, 0x95,
|
||||
0x97, 0x64, 0x2a, 0x72,
|
||||
0xc5, 0x60, 0xc5, 0x12, 0xfa, 0x27, 0x04, 0xd5, 0x7d, 0x05, 0x9a, 0xdb,
|
||||
0x21, 0xdb, 0x8d, 0xbd,
|
||||
0x52, 0x8c, 0xcd, 0xc2, 0x67, 0x75, 0x89, 0x58, 0x23, 0x5b, 0xed, 0x8a,
|
||||
0xc2, 0x32, 0x66, 0xd5,
|
||||
0x04, 0xc5, 0x04, 0x38, 0x8b, 0xa6, 0xd6, 0x3d, 0x8f, 0xae, 0x2e, 0xf0,
|
||||
0xef, 0x9b, 0x68, 0xaf,
|
||||
0x45, 0xd7, 0xcc, 0xef, 0x51, 0x83, 0x79, 0xf0, 0xb1, 0x84, 0xa1, 0x2b,
|
||||
0xd7, 0xf8, 0xf1, 0xe8,
|
||||
0xcf, 0x4e, 0x2c, 0xbc, 0xa9, 0x67, 0x78, 0xf4, 0xa3, 0x3e, 0x6f, 0xd5,
|
||||
0xf7, 0x26, 0xca, 0xe0,
|
||||
0xa6, 0x1a, 0xc9, 0x8e, 0xa0, 0xb3, 0xe3, 0x6e, 0xbc, 0x41, 0x6b, 0x1e,
|
||||
0xed, 0x35, 0xf4, 0xe4,
|
||||
0xc9, 0x5c, 0x79, 0xdd, 0xec, 0x39, 0x2f, 0x93, 0xc8, 0x5a, 0xf3, 0x98,
|
||||
0xed, 0x59, 0xeb, 0x1c,
|
||||
0x72, 0x3f, 0xcc, 0xb8, 0x12, 0x7c, 0x60, 0xbb, 0x9c, 0x32, 0x47, 0x9e,
|
||||
0x24, 0x72, 0xd4, 0xee,
|
||||
0x57, 0x01, 0x85, 0x63, 0x8c, 0x3b, 0xe5, 0xc6, 0x05, 0xc6, 0xaa, 0x13,
|
||||
0x65, 0x33, 0x23, 0x4e,
|
||||
0xca, 0x19, 0x0b, 0xd7, 0x67, 0x98, 0x75, 0x02, 0x7a, 0x55, 0x68, 0xb5,
|
||||
0x08, 0x0b, 0x59, 0x25,
|
||||
0x3a, 0xcd, 0xce, 0xd5, 0x0e, 0xdf, 0x78, 0x4c, 0x1e, 0x91, 0xbb, 0xe4,
|
||||
0x77, 0xe8, 0xf9, 0xbc,
|
||||
0xa5, 0xef, 0x7d, 0xe4, 0xcf, 0x46, 0xef, 0xfb, 0x2d, 0xeb, 0xbf, 0x23,
|
||||
0x3d, 0xb1, 0xcd, 0x7e,
|
||||
0xfe, 0x7f, 0x0b, 0x7f, 0xce, 0xa3, 0x77, 0x32, 0x12, 0x95, 0xe9, 0xfb,
|
||||
0x28, 0x4d, 0x70, 0xf1,
|
||||
0x8e, 0xa9, 0x8d, 0xf3, 0xa2, 0xee, 0xed, 0x1e, 0x84, 0xdb, 0x18, 0xae,
|
||||
0x6a, 0xc6, 0x05, 0xd3,
|
||||
0xfd, 0x7a, 0x66, 0x6e, 0x31, 0x76, 0xca, 0x38, 0x6c, 0x16, 0xe6, 0xbc,
|
||||
0x3b, 0x62, 0x9b, 0x7d,
|
||||
0x23, 0x51, 0xb0, 0x59, 0x66, 0xe3, 0x17, 0x53, 0x03, 0xa0, 0x8e, 0xab,
|
||||
0x16, 0x2f, 0x89, 0x23,
|
||||
0x7f, 0xbe, 0x4e, 0xad, 0x76, 0xc4, 0xc4, 0x71, 0xd6, 0x2c, 0x83, 0x73,
|
||||
0x6f, 0xcb, 0x3b, 0xf2,
|
||||
0x27, 0x24, 0xaf, 0x63, 0x1d, 0x65, 0xb1, 0x25, 0x70, 0x75, 0xdc, 0xd2,
|
||||
0xeb, 0xc1, 0x09, 0xe6,
|
||||
0x4d, 0xc2, 0x27, 0x2b, 0x91, 0x25, 0x4b, 0x66, 0xa0, 0xb3, 0xa3, 0x6e,
|
||||
0xa8, 0xf3, 0xe1, 0x08,
|
||||
0x78, 0x9f, 0x8a, 0x04, 0xf1, 0xd8, 0xfb, 0x84, 0xbb, 0xfd, 0x18, 0x2b,
|
||||
0xdf, 0x43, 0x04, 0xcc,
|
||||
0x46, 0x37, 0x5e, 0x2a, 0xeb, 0xd0, 0x63, 0x29, 0xe3, 0x96, 0x6b, 0xbe,
|
||||
0x5c, 0x38, 0x8e, 0x1e,
|
||||
0x9f, 0x64, 0x9f, 0xab, 0x86, 0x7a, 0x32, 0xf6, 0x39, 0x6e, 0xf6, 0x9c,
|
||||
0x47, 0x02, 0x75, 0xd7,
|
||||
0x7b, 0xbf, 0xa6, 0xea, 0xcb, 0xd1, 0x31, 0xdd, 0x1f, 0x8f, 0x56, 0xcb,
|
||||
0xd8, 0x35, 0xcf, 0xf9,
|
||||
0xf4, 0x29, 0x99, 0xaa, 0x65, 0x1a, 0x98, 0x04, 0xb7, 0xd1, 0xf8, 0x95,
|
||||
0xb7, 0xef, 0x0d, 0xe8,
|
||||
0x25, 0x43, 0x75, 0xa7, 0xc9, 0xe9, 0x51, 0xc6, 0x77, 0x14, 0x75, 0x77,
|
||||
0x42, 0xf5, 0x9f, 0xe3,
|
||||
0xdc, 0x9f, 0x8a, 0xf6, 0x14, 0x2f, 0x53, 0x91, 0xfa, 0x44, 0x00, 0x6d,
|
||||
0x28, 0x7f, 0x5c, 0xcf,
|
||||
0xb8, 0x12, 0xb4, 0xe6, 0xd2, 0xb6, 0x3f, 0x6a, 0x64, 0x0d, 0x16, 0xda,
|
||||
0x68, 0x6c, 0x93, 0x82,
|
||||
0xda, 0x5b, 0x92, 0xba, 0xce, 0x78, 0x2a, 0xea, 0x65, 0xfb, 0x5a, 0xc7,
|
||||
0x5a, 0x66, 0xcd, 0x42,
|
||||
0x7b, 0x33, 0x03, 0x62, 0x06, 0x5a, 0xcc, 0x90, 0x85, 0xf0, 0xf3, 0x6a,
|
||||
0x1b, 0xbc, 0xe6, 0xf3,
|
||||
0xdb, 0x59, 0xf9, 0x33, 0x63, 0xa7, 0x63, 0x8b, 0x64, 0xe2, 0xf6, 0xb8,
|
||||
0xd9, 0x7e, 0x90, 0x1a,
|
||||
0xef, 0x08, 0xd7, 0x41, 0xb3, 0xe5, 0x04, 0xde, 0x93, 0x8e, 0x16, 0x4a,
|
||||
0xd0, 0xd1, 0x29, 0xb3,
|
||||
0xb5, 0x19, 0xe9, 0xfb, 0x41, 0x61, 0x06, 0x51, 0x92, 0x80, 0xdc, 0x9e,
|
||||
0xf6, 0xc3, 0x64, 0xd5,
|
||||
0x3f, 0x21, 0xbd, 0xd3, 0xb2, 0xde, 0x21, 0x32, 0xf4, 0xc3, 0x5a, 0x23,
|
||||
0x27, 0x2c, 0xf3, 0xcf,
|
||||
0xb1, 0x87, 0x75, 0x25, 0x5a, 0x66, 0x42, 0x7f, 0x0c, 0xb9, 0xac, 0xd9,
|
||||
0xec, 0x3b, 0xc9, 0x89,
|
||||
0x5a, 0x69, 0x78, 0xbb, 0xa5, 0xcd, 0x8a, 0x13, 0xf4, 0x67, 0xe1, 0x71,
|
||||
0xb1, 0x16, 0x7a, 0x2e,
|
||||
0x99, 0x6e, 0x83, 0x4f, 0xa5, 0x85, 0x5a, 0xb2, 0x5e, 0x86, 0x45, 0x2a,
|
||||
0x45, 0x33, 0x8a, 0xac,
|
||||
0x99, 0x44, 0xc4, 0xb7, 0x98, 0x6d, 0xc7, 0x90, 0xeb, 0x84, 0x65, 0xcd,
|
||||
0x74, 0xe4, 0xc9, 0xc1,
|
||||
0xe2, 0xc7, 0x03, 0xae, 0xea, 0xc2, 0x51, 0x59, 0x8b, 0x37, 0x4c, 0x64,
|
||||
0x54, 0x20, 0xfd, 0x4f,
|
||||
0xe3, 0x8c, 0xb3, 0x4e, 0xd6, 0x1a, 0x9b, 0xc5, 0x51, 0xd3, 0x29, 0xb1,
|
||||
0xcb, 0xb4, 0x11, 0xb1,
|
||||
0x9b, 0xed, 0x2b, 0x45, 0x61, 0x56, 0x10, 0x34, 0x60, 0x03, 0x55, 0x85,
|
||||
0x1d, 0x64, 0x1f, 0xbc,
|
||||
0x1c, 0x8e, 0xca, 0xed, 0x44, 0xeb, 0x34, 0x4e, 0x2d, 0xb5, 0x68, 0xc6,
|
||||
0xd3, 0xba, 0x1b, 0xfd,
|
||||
0x2e, 0x20, 0x67, 0xce, 0x87, 0xc6, 0x6e, 0xcb, 0xd8, 0x24, 0x72, 0xfd,
|
||||
0x64, 0x4e, 0x5d, 0x9b,
|
||||
0xd0, 0xad, 0xa7, 0xf5, 0x90, 0x0c, 0x65, 0xb5, 0xe9, 0x7a, 0x27, 0x7f,
|
||||
0xc5, 0x6c, 0x6d, 0x61,
|
||||
0x37, 0x7a, 0x8e, 0x5d, 0x62, 0x1a, 0x51, 0xe2, 0x69, 0xdb, 0x47, 0x1c,
|
||||
0xdf, 0x81, 0xcd, 0x5b,
|
||||
0x2c, 0xeb, 0x9c, 0x90, 0x07, 0xa5, 0x1b, 0x51, 0xd1, 0x08, 0xdf, 0x93,
|
||||
0xb1, 0xcf, 0x56, 0xcb,
|
||||
0x7a, 0x2d, 0xc4, 0x69, 0x2a, 0xb9, 0x78, 0x17, 0xda, 0x3b, 0xe4, 0xc3,
|
||||
0xf5, 0x1e, 0x1d, 0x1f,
|
||||
0xe7, 0xf4, 0x3e, 0x3b, 0x91, 0x68, 0x6b, 0xf6, 0xe9, 0x3d, 0x46, 0x5d,
|
||||
0x95, 0xaf, 0x2b, 0x3e,
|
||||
0x21, 0x6f, 0xd6, 0x5b, 0x38, 0x50, 0xdc, 0x0e, 0xc0, 0xce, 0xa9, 0xc4,
|
||||
0xc1, 0x1e, 0x0b, 0x17,
|
||||
0xbb, 0xcc, 0x55, 0x5b, 0x64, 0x14, 0x56, 0x2e, 0x46, 0x1f, 0x87, 0x2d,
|
||||
0xb3, 0x76, 0x6b, 0x1f,
|
||||
0x6e, 0xb1, 0xcc, 0xd9, 0x45, 0x4b, 0x0d, 0x23, 0xeb, 0xf0, 0xca, 0xb6,
|
||||
0x16, 0xa8, 0x27, 0x93,
|
||||
0x60, 0x21, 0x63, 0xbd, 0xd8, 0xb1, 0x59, 0xe7, 0xa9, 0x71, 0x71, 0xeb,
|
||||
0xec, 0xcb, 0x88, 0x89,
|
||||
0xa5, 0xe4, 0x9d, 0x40, 0x98, 0xc3, 0x35, 0x03, 0x49, 0x5f, 0x62, 0x17,
|
||||
0xdc, 0x6a, 0x62, 0x3b,
|
||||
0xfa, 0x6c, 0x61, 0x9d, 0x3d, 0x96, 0x36, 0x85, 0x83, 0x9c, 0x72, 0xeb,
|
||||
0xf4, 0xea, 0xbb, 0xcc,
|
||||
0xb6, 0x6d, 0x9c, 0x22, 0xba, 0xcb, 0x7f, 0xa2, 0xcb, 0x8e, 0x68, 0xf4,
|
||||
0x80, 0xd9, 0xbe, 0x03,
|
||||
0x4e, 0xa2, 0xb4, 0xef, 0x16, 0x22, 0x85, 0xa7, 0x75, 0x37, 0x96, 0xc9,
|
||||
0x81, 0x46, 0x1e, 0xeb,
|
||||
0x7a, 0x57, 0x3c, 0x2c, 0xe1, 0xec, 0x35, 0x0e, 0xfc, 0x61, 0xa7, 0xd9,
|
||||
0xf6, 0x32, 0x96, 0x79,
|
||||
0x1c, 0x7a, 0xdb, 0xcc, 0x75, 0x0e, 0xb1, 0xeb, 0xdc, 0x4a, 0x84, 0xce,
|
||||
0x85, 0xeb, 0x39, 0xe4,
|
||||
0x94, 0x34, 0xf6, 0xfa, 0x6d, 0xe6, 0xf8, 0x7d, 0x78, 0x47, 0x0e, 0x36,
|
||||
0x19, 0x2a, 0x37, 0xca,
|
||||
0x53, 0x16, 0x3e, 0xb6, 0xe3, 0x33, 0x37, 0x63, 0x97, 0x4e, 0xf2, 0x77,
|
||||
0xbd, 0xa3, 0x27, 0x92,
|
||||
0x93, 0xad, 0x32, 0xed, 0x97, 0xde, 0xfa, 0xe4, 0x9c, 0x8f, 0xd7, 0xcd,
|
||||
0xb1, 0xc8, 0xa5, 0xd0,
|
||||
0x42, 0x16, 0x2e, 0x64, 0xc7, 0x5a, 0xae, 0x6b, 0x38, 0xaf, 0xc4, 0xd6,
|
||||
0x35, 0xd5, 0x3d, 0xce,
|
||||
0x55, 0x96, 0xfe, 0x6d, 0x50, 0x4c, 0x93, 0x47, 0x39, 0x07, 0x6e, 0x41,
|
||||
0x06, 0xeb, 0x3a, 0xc3,
|
||||
0x89, 0xe7, 0x46, 0xad, 0x71, 0x5f, 0x34, 0x62, 0x1d, 0x6c, 0x64, 0xac,
|
||||
0x91, 0xbc, 0xda, 0x4e,
|
||||
0x89, 0x9d, 0x6a, 0xd3, 0x12, 0x56, 0xda, 0x17, 0x8b, 0xc2, 0x82, 0x20,
|
||||
0x98, 0x8f, 0x06, 0x33,
|
||||
0x58, 0x73, 0x9d, 0x89, 0x0d, 0xec, 0x7e, 0x0f, 0xc8, 0x7f, 0x53, 0x41,
|
||||
0xa7, 0xa2, 0xd7, 0x75,
|
||||
0x16, 0xec, 0x92, 0x7b, 0x89, 0x11, 0x55, 0x5d, 0x6c, 0x36, 0xdb, 0xb6,
|
||||
0x22, 0x53, 0x7b, 0x64,
|
||||
0x9e, 0x82, 0xff, 0x0f, 0x67, 0xc7, 0x6e, 0x32, 0x7b, 0xb6, 0x93, 0xc5,
|
||||
0xab, 0xd0, 0x52, 0x2c,
|
||||
0xa3, 0xd7, 0xbb, 0xdb, 0x36, 0x52, 0x67, 0x0c, 0xa3, 0x2d, 0x07, 0xcf,
|
||||
0xf2, 0xb4, 0x6d, 0xc2,
|
||||
0xfb, 0xee, 0x84, 0x8b, 0x22, 0x64, 0xda, 0x64, 0xe1, 0x62, 0x01, 0xb2,
|
||||
0x6c, 0x74, 0xff, 0xb6,
|
||||
0x1e, 0x4d, 0xdf, 0x4f, 0x66, 0x9e, 0x4a, 0x0e, 0x77, 0xf1, 0x3d, 0x83,
|
||||
0x75, 0xbd, 0x34, 0xd4,
|
||||
0x6a, 0x23, 0xb0, 0xfb, 0x1c, 0xec, 0x92, 0xc8, 0xce, 0xb6, 0xcd, 0x42,
|
||||
0x67, 0x39, 0x5c, 0x67,
|
||||
0x62, 0x97, 0x6a, 0xac, 0x3d, 0x4d, 0x47, 0xe7, 0x3a, 0x1f, 0xbc, 0x0c,
|
||||
0xcf, 0x0a, 0x5b, 0x2c,
|
||||
0xab, 0xbb, 0x78, 0x5d, 0x8a, 0x8f, 0xd4, 0x52, 0xd9, 0x2c, 0x82, 0xca,
|
||||
0x3a, 0x3f, 0xac, 0x67,
|
||||
0xf4, 0x2e, 0x6c, 0x96, 0x82, 0x57, 0x36, 0x59, 0xda, 0xf7, 0xb0, 0x5a,
|
||||
0x07, 0x2c, 0xd6, 0x97,
|
||||
0x9c, 0xbb, 0xce, 0x32, 0xaf, 0x09, 0x0e, 0x6c, 0x70, 0xb0, 0x30, 0x80,
|
||||
0x0d, 0xb4, 0x85, 0x8c,
|
||||
0x15, 0x32, 0x56, 0xd9, 0xac, 0x26, 0x2b, 0x71, 0xa9, 0xa1, 0x5a, 0x17,
|
||||
0x92, 0x69, 0x16, 0x07,
|
||||
0xc0, 0x12, 0x7a, 0x6a, 0xc8, 0x61, 0x6b, 0x90, 0xcc, 0x83, 0x2d, 0x9c,
|
||||
0x8b, 0xee, 0x85, 0xd3,
|
||||
0x5c, 0xf9, 0x07, 0xbe, 0xb7, 0xda, 0xd2, 0xb3, 0x59, 0xfe, 0x8a, 0xcd,
|
||||
0x0a, 0xf0, 0x8c, 0x95,
|
||||
0x66, 0xdb, 0x26, 0xec, 0xdb, 0x47, 0xdf, 0xcd, 0x53, 0x77, 0x79, 0x5f,
|
||||
0x44, 0x16, 0x4f, 0xcf,
|
||||
0x5a, 0x5a, 0x6d, 0xd8, 0x23, 0x85, 0x6b, 0xa5, 0x85, 0x46, 0x1f, 0x5d,
|
||||
0xe7, 0x7b, 0x57, 0xdc,
|
||||
0x28, 0x83, 0xd9, 0x17, 0xe6, 0x90, 0x9d, 0xaa, 0x7c, 0x56, 0x5b, 0x69,
|
||||
0x99, 0xb5, 0x16, 0x9e,
|
||||
0xd4, 0xbe, 0xf3, 0x12, 0x1c, 0xbb, 0xe0, 0xc4, 0xee, 0x8b, 0x64, 0x85,
|
||||
0x39, 0x62, 0x03, 0xbe,
|
||||
0x50, 0xa0, 0xa5, 0x9c, 0x42, 0x0e, 0x5c, 0x6b, 0xa1, 0xb2, 0x80, 0xaa,
|
||||
0x65, 0xb6, 0xce, 0x35,
|
||||
0x4b, 0xd8, 0x3d, 0x52, 0x2d, 0x7d, 0xff, 0x1e, 0x4d, 0x9c, 0x20, 0x5e,
|
||||
0x60, 0xef, 0xb0, 0xc3,
|
||||
0xdb, 0x4a, 0x9f, 0x9e, 0x55, 0xd8, 0x7d, 0x0d, 0x3e, 0x30, 0x15, 0x3f,
|
||||
0x49, 0xc1, 0x4b, 0x56,
|
||||
0x5b, 0x56, 0x5b, 0x2c, 0xff, 0xa7, 0x4f, 0x3f, 0x73, 0xe8, 0xb1, 0xea,
|
||||
0x75, 0x15, 0x5e, 0x16,
|
||||
0x41, 0x84, 0x2c, 0x69, 0x63, 0x89, 0x25, 0x2e, 0x3b, 0x1a, 0x4b, 0x25,
|
||||
0x5b, 0xc7, 0x59, 0x46,
|
||||
0xe2, 0x22, 0x43, 0x65, 0x92, 0xb9, 0x48, 0xb7, 0x2c, 0x00, 0x96, 0x33,
|
||||
0x63, 0x22, 0xd9, 0xdc,
|
||||
0x1b, 0x87, 0x8b, 0xe0, 0x32, 0x1c, 0xaf, 0x5f, 0x89, 0x7e, 0x6a, 0xd9,
|
||||
0x39, 0x97, 0x5a, 0xfc,
|
||||
0x61, 0x15, 0xf9, 0x45, 0xed, 0x66, 0x8d, 0x16, 0x6f, 0x59, 0x08, 0x1f,
|
||||
0x0b, 0x88, 0x9e, 0xb9,
|
||||
0x5c, 0xf3, 0xc1, 0x42, 0x0b, 0xa5, 0xa9, 0xd8, 0x70, 0x2e, 0x12, 0x64,
|
||||
0x41, 0xcb, 0xd3, 0xba,
|
||||
0x8c, 0x8c, 0x99, 0x48, 0xac, 0x2e, 0x31, 0x5b, 0x56, 0x10, 0x3f, 0xd5,
|
||||
0x70, 0x50, 0xee, 0xc3,
|
||||
0x87, 0x2f, 0x96, 0xe3, 0xb9, 0x39, 0x7a, 0xf6, 0x72, 0xf7, 0x35, 0x07,
|
||||
0xaf, 0xb2, 0xf2, 0xb1,
|
||||
0x9c, 0x1d, 0xb1, 0x98, 0x7f, 0x97, 0xc2, 0xa1, 0xcd, 0x42, 0x7d, 0x11,
|
||||
0x3b, 0xc6, 0x93, 0x8c,
|
||||
0x5e, 0xae, 0x67, 0x39, 0xa9, 0x19, 0x5e, 0x0a, 0x9a, 0x73, 0xac, 0x50,
|
||||
0x67, 0xa3, 0x1b, 0x91,
|
||||
0x60, 0x01, 0x59, 0x73, 0xa6, 0x4f, 0x74, 0x2c, 0xc1, 0x6f, 0x6f, 0x92,
|
||||
0xff, 0xa0, 0x16, 0xba,
|
||||
0x15, 0xff, 0x13, 0x7c, 0x7e, 0x91, 0xd9, 0xf7, 0x12, 0x5c, 0x0e, 0x40,
|
||||
0x8a, 0x15, 0x7c, 0x9a,
|
||||
0xc4, 0xe7, 0x97, 0x2c, 0x7c, 0x38, 0xf1, 0x81, 0xf9, 0x6e, 0x3e, 0xac,
|
||||
0x58, 0xe1, 0xca, 0xf6,
|
||||
0xc6, 0x42, 0xc9, 0xc0, 0x66, 0x9d, 0x6b, 0x13, 0xe3, 0xe7, 0x19, 0x6a,
|
||||
0x9f, 0x6b, 0xc4, 0x17,
|
||||
0x56, 0x06, 0xc0, 0x2a, 0x64, 0x9c, 0x80, 0xae, 0xe6, 0x30, 0xc2, 0x85,
|
||||
0xb9, 0xe8, 0xee, 0x51,
|
||||
0xf8, 0x5a, 0x0d, 0xad, 0x06, 0x32, 0xf3, 0x3c, 0xb3, 0xa7, 0x91, 0xd6,
|
||||
0x07, 0xe0, 0xd7, 0xa1,
|
||||
0xe9, 0x79, 0xe1, 0x9f, 0x9d, 0xbd, 0x58, 0x84, 0xb6, 0x16, 0xf0, 0x7f,
|
||||
0x14, 0x9f, 0x3c, 0x6d,
|
||||
0xf3, 0xd8, 0x21, 0xfa, 0xa1, 0xd7, 0xd9, 0xe6, 0x7a, 0x95, 0x44, 0xf5,
|
||||
0x42, 0xf8, 0xa8, 0x44,
|
||||
0xe7, 0x73, 0x7d, 0xe6, 0x5b, 0xb1, 0x10, 0x2a, 0xf5, 0x48, 0xe8, 0xe2,
|
||||
0x5a, 0x3d, 0x37, 0xb1,
|
||||
0xe1, 0xb9, 0xb3, 0x2d, 0x6b, 0x0d, 0x46, 0x8e, 0x55, 0x70, 0x3d, 0x83,
|
||||
0x28, 0xf6, 0x72, 0x3d,
|
||||
0x07, 0xff, 0x7b, 0x0a, 0x5d, 0xb9, 0x66, 0xcd, 0xc6, 0x7f, 0xe6, 0x05,
|
||||
0x5d, 0xc3, 0x3b, 0x47,
|
||||
0x9d, 0x87, 0xff, 0x8b, 0x3c, 0xba, 0x02, 0x99, 0x0b, 0xf9, 0x3c, 0xdb,
|
||||
0x22, 0xed, 0x3c, 0xf9,
|
||||
0x3d, 0xa7, 0xf8, 0x49, 0x7c, 0x9a, 0xcf, 0x55, 0xc2, 0x27, 0xaf, 0xf6,
|
||||
0x16, 0xe0, 0xe5, 0xf1,
|
||||
0x70, 0xa9, 0x22, 0x6f, 0x3a, 0x3b, 0xc5, 0x3c, 0xcb, 0xbc, 0x06, 0x2c,
|
||||
0x3c, 0xd7, 0xcd, 0x87,
|
||||
0x15, 0xab, 0xe9, 0xc3, 0x46, 0xc6, 0x3c, 0x49, 0xc3, 0x66, 0x5d, 0xa6,
|
||||
0x8e, 0x8c, 0x9b, 0x6d,
|
||||
0x9f, 0x81, 0x14, 0xf5, 0x96, 0xcc, 0xef, 0x9b, 0x95, 0x57, 0xe2, 0x27,
|
||||
0x85, 0x8c, 0x98, 0xe6,
|
||||
0xc6, 0x4c, 0x7e, 0x1b, 0x08, 0xdd, 0xf5, 0xe4, 0x90, 0xf9, 0xf8, 0xf2,
|
||||
0x54, 0xd6, 0xf6, 0xf4,
|
||||
0xcd, 0x26, 0x5b, 0x3a, 0xb1, 0x59, 0x9d, 0xd9, 0xe2, 0x9a, 0x51, 0x1f,
|
||||
0x10, 0x33, 0xe1, 0xf0,
|
||||
0x19, 0x7c, 0x6e, 0x99, 0xbe, 0xa7, 0xee, 0x59, 0x61, 0x3a, 0xd1, 0xfb,
|
||||
0x0c, 0x94, 0x3c, 0xb3,
|
||||
0x1b, 0x91, 0x3f, 0x12, 0x4e, 0x56, 0x52, 0x09, 0x5a, 0xf9, 0xf0, 0xc7,
|
||||
0x4c, 0x2c, 0x92, 0x0d,
|
||||
0xb5, 0x35, 0x5a, 0x92, 0xb5, 0x7c, 0x52, 0x1e, 0xee, 0xe5, 0xad, 0x01,
|
||||
0x3a, 0x15, 0xf4, 0xad,
|
||||
0xe1, 0x93, 0x4d, 0x57, 0xd0, 0x2e, 0xcc, 0x20, 0x8f, 0xf4, 0xc2, 0x06,
|
||||
0xeb, 0xf4, 0x3c, 0x25,
|
||||
0xd1, 0x4c, 0x3f, 0xca, 0x56, 0x9e, 0x9d, 0xcc, 0x9e, 0x47, 0x5b, 0x7f,
|
||||
0x2c, 0x96, 0x86, 0xc5,
|
||||
0xd6, 0xc3, 0xfd, 0x78, 0xbc, 0x7a, 0xba, 0x65, 0xf4, 0x58, 0xf2, 0xb4,
|
||||
0xca, 0xe8, 0x1b, 0xb8,
|
||||
0x96, 0xeb, 0xbb, 0x70, 0x5e, 0xae, 0xd5, 0x9b, 0x36, 0x39, 0x58, 0x61,
|
||||
0x03, 0x7c, 0xcc, 0x62,
|
||||
0xb7, 0xf0, 0xae, 0xa5, 0x28, 0x28, 0x0f, 0x6e, 0x6b, 0x83, 0x8d, 0xfa,
|
||||
0x1c, 0x36, 0xc3, 0x68,
|
||||
0x94, 0x94, 0xda, 0xce, 0xd4, 0xfa, 0x03, 0x62, 0x1a, 0xec, 0x75, 0x8e,
|
||||
0x3a, 0xb4, 0xbc, 0x81,
|
||||
0x9d, 0x67, 0x63, 0x1b, 0xa8, 0x5d, 0xb7, 0x8e, 0x8c, 0x5d, 0x83, 0xb7,
|
||||
0xb8, 0x50, 0x83, 0x4d,
|
||||
0x86, 0xb2, 0xea, 0x66, 0x66, 0xcc, 0xc7, 0x63, 0xbd, 0x3d, 0x93, 0x58,
|
||||
0xf7, 0x31, 0x74, 0x5c,
|
||||
0xc0, 0xbe, 0x33, 0xc9, 0x32, 0x3e, 0x5f, 0x3f, 0x1b, 0xf6, 0xc0, 0xfa,
|
||||
0x04, 0xd6, 0x86, 0xb6,
|
||||
0x96, 0xb1, 0x82, 0x93, 0xba, 0x7f, 0x8a, 0x39, 0x63, 0x0a, 0x55, 0x89,
|
||||
0xf7, 0x37, 0x27, 0x27,
|
||||
0xb3, 0x09, 0xec, 0xa1, 0x6b, 0x68, 0x33, 0x7c, 0x56, 0xf3, 0xc7, 0x14,
|
||||
0x72, 0xea, 0x14, 0xbc,
|
||||
0x69, 0xa3, 0x96, 0x64, 0xa9, 0xbe, 0x17, 0x32, 0xd9, 0xec, 0xad, 0x23,
|
||||
0x27, 0x4d, 0xa0, 0x67,
|
||||
0x03, 0x5e, 0x6f, 0xe5, 0x7a, 0x32, 0x79, 0xb8, 0x37, 0x5c, 0x6c, 0x42,
|
||||
0x22, 0x75, 0x77, 0x2d,
|
||||
0xcf, 0x6f, 0x8d, 0x5a, 0xf7, 0xb3, 0x6d, 0x17, 0xef, 0x31, 0x50, 0xf9,
|
||||
0xb3, 0xfc, 0x0f, 0x7b,
|
||||
0x40, 0xb1, 0xae, 0x8e, 0x36, 0xe1, 0x4b, 0xe5, 0x50, 0xf0, 0xae, 0xa3,
|
||||
0xf2, 0x7d, 0x8c, 0xae,
|
||||
0xd3, 0x14, 0xc5, 0x55, 0xb4, 0xe4, 0xfb, 0xf4, 0x46, 0x41, 0x65, 0xad,
|
||||
0xae, 0xba, 0x94, 0xef,
|
||||
0x58, 0xf9, 0xa8, 0xa4, 0xbe, 0x5e, 0xaa, 0x69, 0xfa, 0xda, 0xa0, 0x09,
|
||||
0x3f, 0xc0, 0x42, 0x46,
|
||||
0xbd, 0x8c, 0xc1, 0x66, 0x61, 0x33, 0x1e, 0x8d, 0x72, 0xda, 0x6b, 0x1c,
|
||||
0x6a, 0xe6, 0x06, 0xf6,
|
||||
0xcd, 0xa6, 0x36, 0xd8, 0x0a, 0x85, 0xd9, 0xac, 0x52, 0xa1, 0xef, 0xe0,
|
||||
0x95, 0xeb, 0x3b, 0xb8,
|
||||
0x25, 0xc4, 0xd9, 0x62, 0xc6, 0xaf, 0xc5, 0x4b, 0xf2, 0x2c, 0x3d, 0xe5,
|
||||
0x50, 0x79, 0x82, 0x1c,
|
||||
0xa4, 0xee, 0xe2, 0x7b, 0x5b, 0x6b, 0x38, 0x45, 0xdd, 0xc2, 0x19, 0xe0,
|
||||
0x5e, 0xae, 0xbb, 0xf9,
|
||||
0x7c, 0x3b, 0xf8, 0xb3, 0xc6, 0x9d, 0x72, 0x0f, 0x5c, 0x2b, 0x9e, 0x56,
|
||||
0xe0, 0xb3, 0x25, 0x96,
|
||||
0x39, 0x95, 0x96, 0x4f, 0xf9, 0xd4, 0x35, 0x2b, 0xa8, 0xf3, 0x36, 0xe0,
|
||||
0x11, 0xbe, 0xab, 0x95,
|
||||
0x63, 0x03, 0xdf, 0xdf, 0xab, 0xa8, 0x08, 0x17, 0xc0, 0xf1, 0x56, 0x4d,
|
||||
0x53, 0xdd, 0x39, 0xf7,
|
||||
0xf6, 0x4f, 0xa4, 0x52, 0x9b, 0x4c, 0xcf, 0x16, 0x46, 0xd8, 0x7c, 0xe4,
|
||||
0x29, 0xe4, 0x1c, 0xbe,
|
||||
0x50, 0xfb, 0xf3, 0x16, 0x74, 0x66, 0xf8, 0xd1, 0xac, 0x93, 0x76, 0x70,
|
||||
0x7d, 0x0f, 0xb8, 0x9b,
|
||||
0xeb, 0x21, 0xa8, 0x24, 0x63, 0xc7, 0x75, 0xee, 0x8a, 0xbe, 0x09, 0x2d,
|
||||
0x4c, 0xf0, 0x91, 0x77,
|
||||
0x02, 0x36, 0xcb, 0xd6, 0xf7, 0x13, 0x95, 0xf6, 0xd6, 0xeb, 0xb8, 0xab,
|
||||
0xb4, 0x70, 0x98, 0x06,
|
||||
0x8f, 0xab, 0xe9, 0x5b, 0x8f, 0x3c, 0x36, 0x1f, 0x99, 0x0d, 0x72, 0xf4,
|
||||
0xba, 0x00, 0x56, 0xd8,
|
||||
0xc1, 0xc8, 0xc9, 0x52, 0x63, 0x4c, 0x93, 0xc4, 0x9a, 0xce, 0x89, 0xe1,
|
||||
0xce, 0x3b, 0x22, 0x6a,
|
||||
0xed, 0xea, 0x3e, 0x64, 0x25, 0xfe, 0xb2, 0x93, 0xde, 0xb6, 0xd8, 0x86,
|
||||
0x1c, 0xd9, 0x3e, 0xcf,
|
||||
0x7a, 0xca, 0x38, 0x29, 0x96, 0x22, 0x79, 0x83, 0xbe, 0xef, 0x6e, 0xed,
|
||||
0x29, 0x47, 0xfa, 0xe5,
|
||||
0xda, 0x33, 0xbd, 0xad, 0xa5, 0x8c, 0xce, 0x42, 0x27, 0xcb, 0xb0, 0xf3,
|
||||
0x6c, 0xd6, 0x2e, 0xd5,
|
||||
0x99, 0xb0, 0x50, 0xdf, 0xab, 0x99, 0xaf, 0x6b, 0xf0, 0x1d, 0x68, 0xab,
|
||||
0x82, 0x6a, 0xbb, 0x24,
|
||||
0xc0, 0xb3, 0xa3, 0x72, 0x62, 0x20, 0x1e, 0xbe, 0x5f, 0x46, 0x0b, 0x33,
|
||||
0x7d, 0xe8, 0x16, 0xc1,
|
||||
0xf3, 0x5f, 0xc9, 0xa2, 0x15, 0x96, 0x96, 0x12, 0x38, 0x2d, 0xd0, 0xfa,
|
||||
0xdc, 0x41, 0x5c, 0xaa,
|
||||
0xb3, 0x6c, 0xb1, 0x85, 0xd2, 0x33, 0x78, 0xf9, 0xcb, 0xf4, 0x2d, 0xc1,
|
||||
0xf6, 0xc5, 0x96, 0xa7,
|
||||
0x59, 0x25, 0xf4, 0x94, 0x93, 0xa7, 0x57, 0x61, 0xed, 0x15, 0xcc, 0xf1,
|
||||
0xe5, 0xa0, 0x42, 0x1e,
|
||||
0x81, 0xfb, 0xd5, 0xf4, 0xae, 0x06, 0xeb, 0xe1, 0x63, 0x07, 0x54, 0x5e,
|
||||
0x36, 0xf5, 0xb3, 0x11,
|
||||
0x99, 0xc4, 0x47, 0xde, 0xe1, 0xd0, 0xdf, 0xa6, 0x47, 0xa8, 0x53, 0xc2,
|
||||
0x62, 0x2a, 0x51, 0xab,
|
||||
0x64, 0xa5, 0xe4, 0x55, 0xb5, 0x6b, 0x2d, 0xa2, 0xd5, 0xe1, 0x33, 0x2f,
|
||||
0x92, 0xca, 0x76, 0xab,
|
||||
0x85, 0xb2, 0x07, 0x7b, 0xe0, 0x7b, 0x82, 0x4c, 0x34, 0xa6, 0x48, 0x5c,
|
||||
0x4d, 0xe7, 0x84, 0x6e,
|
||||
0xb3, 0xc2, 0x22, 0xc6, 0x4b, 0xb5, 0xbd, 0x0a, 0x9e, 0x1b, 0x39, 0xd5,
|
||||
0xed, 0x0e, 0x88, 0x8d,
|
||||
0x58, 0x26, 0xcf, 0xe7, 0x69, 0x77, 0x01, 0xb9, 0xcc, 0x0e, 0xf2, 0xfc,
|
||||
0x9e, 0x82, 0x8f, 0xc3,
|
||||
0x53, 0xd6, 0x63, 0xe3, 0x31, 0x70, 0x63, 0xfd, 0x89, 0xc6, 0x53, 0x54,
|
||||
0xad, 0x51, 0xa5, 0xdf,
|
||||
0x05, 0x70, 0x68, 0xb8, 0x7e, 0xd6, 0x41, 0x7f, 0x0f, 0x7c, 0x2e, 0xc1,
|
||||
0x32, 0x8e, 0x00, 0xcf,
|
||||
0xd5, 0xc7, 0x51, 0x7b, 0xcd, 0x64, 0xcc, 0x5e, 0x6c, 0xdb, 0xa8, 0xef,
|
||||
0xee, 0x7b, 0x7e, 0xf2,
|
||||
0x99, 0xd1, 0x81, 0x88, 0x1f, 0xeb, 0x33, 0xaf, 0x80, 0xb5, 0x1a, 0xf4,
|
||||
0xdf, 0x32, 0x6e, 0x44,
|
||||
0x0b, 0x63, 0x2d, 0x3d, 0x85, 0xf2, 0x34, 0x5c, 0xa8, 0x3b, 0x14, 0x2b,
|
||||
0xe0, 0xc2, 0xf7, 0x0d,
|
||||
0x0a, 0xf5, 0x54, 0xc9, 0x86, 0x2f, 0x2a, 0xbb, 0x14, 0xfa, 0xf5, 0x8d,
|
||||
0x93, 0x9e, 0xd8, 0x69,
|
||||
0x9f, 0xec, 0x35, 0xb1, 0xc7, 0x47, 0x3b, 0x4d, 0xe4, 0xe3, 0x5c, 0x1f,
|
||||
0x0e, 0x9e, 0x83, 0xfe,
|
||||
0x2e, 0xf7, 0xa8, 0x9d, 0xf0, 0x91, 0xeb, 0xd3, 0xef, 0x20, 0xd2, 0x32,
|
||||
0xf5, 0x53, 0x92, 0x5c,
|
||||
0x9f, 0x75, 0xc6, 0xcb, 0x7d, 0x5c, 0x7b, 0xfc, 0xa8, 0x2b, 0xbc, 0x42,
|
||||
0x14, 0x54, 0x48, 0x95,
|
||||
0x31, 0x49, 0x62, 0x6a, 0xbb, 0x24, 0x76, 0x9b, 0xd5, 0x39, 0x22, 0xa9,
|
||||
0xa0, 0x2a, 0xaf, 0x4c,
|
||||
0x3f, 0xe5, 0x69, 0x81, 0xb3, 0xb6, 0xd8, 0x8f, 0xb6, 0x1a, 0xd0, 0x44,
|
||||
0x9e, 0xcf, 0x4e, 0x94,
|
||||
0x1b, 0xf0, 0x0d, 0x21, 0x3b, 0xfb, 0xd3, 0x16, 0x7d, 0x3a, 0x1c, 0x63,
|
||||
0x19, 0x91, 0xab, 0xdf,
|
||||
0x99, 0xb2, 0x41, 0xc1, 0xfa, 0xb6, 0x52, 0x1e, 0xbc, 0x3f, 0x48, 0xc6,
|
||||
0x53, 0x2b, 0xec, 0xd5,
|
||||
0x92, 0xb5, 0x7d, 0xdf, 0x2b, 0x0f, 0xdf, 0xf8, 0x3b, 0xde, 0xbf, 0x1f,
|
||||
0xec, 0xc4, 0x3b, 0xd3,
|
||||
0x7c, 0xfa, 0x62, 0xe5, 0x79, 0xfd, 0xac, 0xd8, 0xee, 0xf7, 0x7e, 0x56,
|
||||
0x0a, 0x9a, 0xdf, 0xc5,
|
||||
0x8e, 0x51, 0x4e, 0xdd, 0xee, 0xcb, 0x5b, 0xbd, 0x96, 0x68, 0x9d, 0x7e,
|
||||
0x8f, 0x67, 0xac, 0x9f,
|
||||
0x3c, 0x79, 0xc4, 0xc7, 0x34, 0x3c, 0xae, 0xc8, 0xef, 0x9d, 0x2a, 0x97,
|
||||
0x4c, 0x07, 0x02, 0xea,
|
||||
0x46, 0x61, 0x3b, 0x9e, 0x90, 0xe9, 0x33, 0x7e, 0x20, 0xf2, 0xef, 0x85,
|
||||
0x63, 0x57, 0xff, 0xcb,
|
||||
0xd4, 0x0f, 0xa3, 0x7d, 0xb4, 0x97, 0xa7, 0xdf, 0xfc, 0xf2, 0xdf, 0xd9,
|
||||
0x53, 0x38, 0x5f, 0xae,
|
||||
0x34, 0x67, 0x59, 0xd1, 0xcc, 0x9e, 0x33, 0x5e, 0xca, 0x8c, 0x2a, 0x89,
|
||||
0xc2, 0x66, 0xed, 0xaa,
|
||||
0xbb, 0xa6, 0xf6, 0x2e, 0xa9, 0xcc, 0x2a, 0xd1, 0x4f, 0xe3, 0x76, 0x06,
|
||||
0xbc, 0x7b, 0x7a, 0x10,
|
||||
0x3a, 0x4d, 0xfa, 0xee, 0x6a, 0x46, 0x80, 0xb7, 0x34, 0xd5, 0xfb, 0x8c,
|
||||
0xde, 0xdf, 0xb2, 0xf0,
|
||||
0xe5, 0xed, 0xac, 0xb2, 0x06, 0x4d, 0xa6, 0x59, 0xc6, 0x67, 0x04, 0x98,
|
||||
0x6b, 0xc0, 0x63, 0x12,
|
||||
0xba, 0x70, 0xad, 0xb2, 0x8b, 0xbc, 0x19, 0xd9, 0x66, 0x54, 0x0e, 0xb9,
|
||||
0x36, 0x01, 0x3f, 0x3b,
|
||||
0x08, 0xf6, 0x92, 0xa1, 0x92, 0x2d, 0x7d, 0x99, 0x9c, 0x40, 0x63, 0xc9,
|
||||
0x41, 0xe3, 0x65, 0xa4,
|
||||
0x7e, 0x27, 0xd1, 0xbb, 0x56, 0x2c, 0x1e, 0xb8, 0x0d, 0x3d, 0x57, 0xe1,
|
||||
0x39, 0x5e, 0x8a, 0xd9,
|
||||
0xe4, 0x80, 0x06, 0xbd, 0x56, 0x13, 0x76, 0x49, 0x69, 0xc3, 0x4f, 0x36,
|
||||
0xb6, 0x99, 0x88, 0x7f,
|
||||
0x8c, 0x27, 0x97, 0xa5, 0xb7, 0x91, 0xe9, 0x60, 0xd0, 0xfb, 0xbb, 0x3b,
|
||||
0xf5, 0x5d, 0x01, 0x2b,
|
||||
0x9d, 0x7e, 0xc4, 0xea, 0x2b, 0xee, 0x19, 0x07, 0xf5, 0x5b, 0x5c, 0xe9,
|
||||
0x54, 0x25, 0x99, 0x41,
|
||||
0xdf, 0x74, 0x4d, 0xd7, 0xef, 0x7d, 0xa9, 0x7b, 0x45, 0x07, 0x02, 0xae,
|
||||
0x73, 0x84, 0xd3, 0x29,
|
||||
0x79, 0xdf, 0x28, 0x97, 0xc8, 0xda, 0x2e, 0x09, 0xed, 0xaa, 0xc3, 0x53,
|
||||
0xfe, 0x54, 0x51, 0x99,
|
||||
0x5a, 0xa8, 0xdf, 0x91, 0x99, 0xab, 0xef, 0x9e, 0xb6, 0x45, 0x0b, 0x56,
|
||||
0x9b, 0x43, 0xa5, 0x9c,
|
||||
0xae, 0x9f, 0xfc, 0x59, 0x91, 0xca, 0x6a, 0x03, 0xb0, 0x8e, 0xf7, 0xf7,
|
||||
0x7e, 0xfa, 0xce, 0xe8,
|
||||
0x7e, 0x3c, 0xb6, 0xa7, 0x7e, 0x4a, 0x96, 0x1c, 0x10, 0xea, 0x5e, 0xed,
|
||||
0xdf, 0xe5, 0x7e, 0xf6,
|
||||
0xef, 0xc3, 0xee, 0x35, 0x5e, 0x25, 0xd2, 0xd4, 0x73, 0x6c, 0xdf, 0x71,
|
||||
0x59, 0xd4, 0x2b, 0x33,
|
||||
0xf4, 0x98, 0xc3, 0xfa, 0xdd, 0x87, 0x31, 0x96, 0x11, 0xea, 0x3d, 0xc4,
|
||||
0x44, 0xfc, 0x63, 0x33,
|
||||
0x36, 0x4b, 0xf4, 0xe3, 0x6c, 0x34, 0xf9, 0x6f, 0x33, 0xde, 0x19, 0x6f,
|
||||
0x69, 0x4b, 0xc3, 0x66,
|
||||
0xf3, 0xe0, 0xed, 0x10, 0xd9, 0xa7, 0x11, 0x7b, 0xfb, 0xf3, 0x96, 0x06,
|
||||
0xc7, 0xb5, 0xe8, 0xb7,
|
||||
0x42, 0x3f, 0xb9, 0x4c, 0xf6, 0x93, 0xe9, 0x70, 0x40, 0xcd, 0x28, 0xec,
|
||||
0x45, 0x37, 0x49, 0x3e,
|
||||
0x74, 0xfa, 0x60, 0xf7, 0x66, 0xcb, 0x8c, 0x03, 0x44, 0xf6, 0x20, 0xea,
|
||||
0xc5, 0xb6, 0xfa, 0xf3,
|
||||
0xcc, 0xc8, 0xa5, 0x4a, 0x7b, 0x9a, 0x88, 0x0c, 0xbc, 0xc2, 0x09, 0x5d,
|
||||
0x89, 0x15, 0x1a, 0x25,
|
||||
0x32, 0x4a, 0xc5, 0x99, 0x7a, 0xef, 0x6a, 0x52, 0x4a, 0x72, 0x81, 0xe1,
|
||||
0xd0, 0xf7, 0x60, 0x8f,
|
||||
0xb6, 0x79, 0xb2, 0xe4, 0xc2, 0x6b, 0xac, 0x5b, 0x23, 0xff, 0xa4, 0xe2,
|
||||
0x49, 0x32, 0xff, 0xe6,
|
||||
0x25, 0x41, 0x3f, 0x85, 0xf8, 0x03, 0x3b, 0x74, 0x9a, 0x65, 0xfd, 0xe7,
|
||||
0x18, 0x79, 0x54, 0x8f,
|
||||
0x9f, 0xce, 0x59, 0x6d, 0x28, 0x2d, 0x49, 0x8c, 0x8c, 0xb7, 0xcc, 0x4a,
|
||||
0x42, 0x0b, 0x51, 0xd2,
|
||||
0x89, 0x2a, 0x6c, 0x05, 0x94, 0x8f, 0x9a, 0x2b, 0xec, 0x23, 0x2e, 0x22,
|
||||
0x7d, 0x64, 0x51, 0x6f,
|
||||
0xaa, 0x3f, 0x84, 0x24, 0x47, 0xf5, 0xb8, 0x16, 0xf2, 0xa8, 0x7a, 0x56,
|
||||
0xe5, 0xed, 0x7d, 0x1e,
|
||||
0x8f, 0x79, 0x0d, 0xcf, 0x9c, 0x23, 0x43, 0x7c, 0xb4, 0x96, 0x0c, 0x9f,
|
||||
0x45, 0x44, 0x5a, 0x3d,
|
||||
0x19, 0xdd, 0xaa, 0xfb, 0xde, 0x9c, 0xc2, 0x8e, 0x6a, 0x4a, 0x3b, 0xe1,
|
||||
0x64, 0x84, 0x7e, 0x47,
|
||||
0xc2, 0xf3, 0x57, 0x20, 0x49, 0xd0, 0xeb, 0xcd, 0xce, 0xa9, 0xf6, 0xfb,
|
||||
0x68, 0x3f, 0x9d, 0xba,
|
||||
0x64, 0x3a, 0x12, 0x10, 0xea, 0xf9, 0xd4, 0x0a, 0x1f, 0x6f, 0x4b, 0xa5,
|
||||
0xb2, 0xac, 0xb6, 0x48,
|
||||
0xa6, 0x64, 0x6b, 0xa1, 0x32, 0x53, 0x7f, 0x77, 0x9e, 0xc8, 0xb8, 0x44,
|
||||
0x1f, 0x6d, 0xa8, 0xb7,
|
||||
0x34, 0x86, 0x72, 0x76, 0x18, 0x80, 0x8f, 0x05, 0x5b, 0xe3, 0x0c, 0x3b,
|
||||
0xad, 0x5d, 0x1c, 0x46,
|
||||
0xa1, 0xbc, 0xa8, 0xe2, 0x4c, 0xfd, 0x9d, 0xe0, 0xb4, 0xee, 0x31, 0x85,
|
||||
0x76, 0x9b, 0x43, 0xbd,
|
||||
0xc5, 0xb9, 0x5a, 0xce, 0x62, 0xd5, 0x40, 0x50, 0xbc, 0x55, 0xa3, 0xc1,
|
||||
0x1e, 0x44, 0xb9, 0x4b,
|
||||
0xc6, 0x68, 0xe2, 0xe4, 0x77, 0xc8, 0x93, 0xcd, 0x09, 0xf2, 0x2e, 0x5d,
|
||||
0xc7, 0xdf, 0xcd, 0xff,
|
||||
0xf1, 0x70, 0x78, 0x52, 0x8f, 0x57, 0xcf, 0x5f, 0x9e, 0xa5, 0x9e, 0xef,
|
||||
0x81, 0xd7, 0x7b, 0xfe,
|
||||
0xc2, 0x63, 0x0c, 0x9f, 0x9f, 0x92, 0xce, 0xf2, 0xbf, 0xe8, 0x7b, 0x8d,
|
||||
0x0f, 0xfd, 0xe3, 0xf8,
|
||||
0xe5, 0x26, 0x22, 0xe7, 0x2e, 0x93, 0x96, 0xaa, 0xac, 0xbb, 0xe0, 0x47,
|
||||
0x47, 0x4c, 0x0e, 0xf6,
|
||||
0xe1, 0x8f, 0xf7, 0x59, 0xfa, 0xef, 0xc2, 0x32, 0xa7, 0xe4, 0x18, 0x51,
|
||||
0x5d, 0x8a, 0x7f, 0x78,
|
||||
0xdb, 0x55, 0xcf, 0x20, 0xe2, 0x76, 0x35, 0xff, 0xde, 0x69, 0xb6, 0xdd,
|
||||
0x29, 0x8f, 0xd2, 0xa6,
|
||||
0x78, 0x3b, 0xc6, 0x5a, 0x6b, 0xb1, 0xf3, 0xed, 0xcc, 0xea, 0xa5, 0xff,
|
||||
0x8e, 0x7f, 0x00, 0xa7,
|
||||
0xd9, 0xee, 0xf2, 0x00, 0xb5, 0xdc, 0x21, 0xb4, 0xdb, 0xd3, 0x32, 0xcb,
|
||||
0x2a, 0x53, 0x60, 0xbc,
|
||||
0x86, 0x57, 0x45, 0x5b, 0xf8, 0xbe, 0x4b, 0xfe, 0xc2, 0x19, 0xd8, 0x77,
|
||||
0xfc, 0x31, 0x46, 0x6d,
|
||||
0xc1, 0x93, 0xd4, 0x59, 0x61, 0xa8, 0xe9, 0x27, 0x63, 0xf0, 0xc9, 0x27,
|
||||
0xf4, 0x1b, 0x2b, 0xc9,
|
||||
0xfa, 0x39, 0x52, 0x30, 0x9c, 0xd7, 0x6f, 0x69, 0xd8, 0x88, 0xab, 0x11,
|
||||
0xb5, 0x5d, 0x13, 0x5c,
|
||||
0xef, 0x11, 0x87, 0x8d, 0xca, 0x34, 0x72, 0x0d, 0xf5, 0xde, 0x73, 0x36,
|
||||
0xfd, 0x67, 0x7c, 0x9e,
|
||||
0xac, 0x7b, 0x71, 0x12, 0xad, 0x6d, 0x60, 0xbd, 0x7b, 0x24, 0x0c, 0xad,
|
||||
0xb7, 0x97, 0x9b, 0xf1,
|
||||
0x9c, 0x3a, 0x72, 0x80, 0xaa, 0x38, 0x5c, 0x3b, 0x96, 0x7a, 0xb3, 0x76,
|
||||
0xb5, 0xf9, 0xdc, 0xfe,
|
||||
0x14, 0x9f, 0x0e, 0xea, 0xea, 0xe5, 0x3e, 0xc6, 0x87, 0x11, 0x59, 0x1d,
|
||||
0xe5, 0x46, 0xfe, 0x7d,
|
||||
0x8c, 0x91, 0x4b, 0xb1, 0xd1, 0xeb, 0x7e, 0x2b, 0x9d, 0x82, 0xfe, 0x72,
|
||||
0x76, 0xb0, 0x74, 0xf7,
|
||||
0x3b, 0xd9, 0x8a, 0x5e, 0x11, 0x7e, 0xef, 0xed, 0x3f, 0x46, 0x85, 0x60,
|
||||
0x33, 0xfb, 0xb3, 0xc8,
|
||||
0xff, 0x4d, 0x50, 0x39, 0x0d, 0xad, 0x83, 0xec, 0x44, 0x19, 0x26, 0x32,
|
||||
0xf5, 0xb3, 0x4b, 0xf5,
|
||||
0xd4, 0xae, 0xde, 0xa7, 0x6d, 0x2a, 0xb6, 0xf2, 0xd0, 0x3a, 0xce, 0x8e,
|
||||
0x53, 0x8f, 0xae, 0xfa,
|
||||
0xcb, 0xe3, 0xd8, 0xf2, 0x51, 0xec, 0x34, 0x80, 0xda, 0x60, 0x1f, 0x3d,
|
||||
0x2d, 0xfa, 0x59, 0x92,
|
||||
0x97, 0x07, 0xab, 0x4c, 0x81, 0xa0, 0x9e, 0x9c, 0x2f, 0xd6, 0xbb, 0xba,
|
||||
0x67, 0x46, 0x25, 0xf9,
|
||||
0xf2, 0x4c, 0xc0, 0x71, 0x6b, 0xd0, 0xf0, 0x13, 0xd2, 0x15, 0x74, 0x46,
|
||||
0x13, 0x37, 0x92, 0x11,
|
||||
0x7b, 0xb0, 0xea, 0x26, 0xe8, 0xbf, 0x1e, 0x94, 0xfe, 0x69, 0x79, 0x1b,
|
||||
0x3d, 0x64, 0xc9, 0x58,
|
||||
0xc3, 0x26, 0xc3, 0xdc, 0x36, 0x53, 0x75, 0x48, 0x9f, 0xa2, 0xbc, 0x9c,
|
||||
0x2c, 0xfd, 0xf6, 0xfd,
|
||||
0x62, 0x79, 0x57, 0xce, 0x06, 0xc1, 0xeb, 0xfa, 0xfd, 0x8c, 0xdd, 0x68,
|
||||
0x76, 0x0e, 0x1e, 0xd9,
|
||||
0x84, 0xef, 0xb8, 0x5a, 0xcf, 0xb8, 0x39, 0x54, 0xfd, 0x67, 0xf5, 0xe5,
|
||||
0x9d, 0x71, 0x06, 0x4d,
|
||||
0xef, 0x45, 0xd7, 0xf3, 0xf5, 0x9d, 0xc3, 0xe5, 0xfa, 0x29, 0xb1, 0x7a,
|
||||
0x97, 0xe3, 0x8d, 0x00,
|
||||
0xf4, 0xcf, 0x58, 0x68, 0x9d, 0xd6, 0xbf, 0x9d, 0xf5, 0xa1, 0x77, 0xc6,
|
||||
0x0d, 0x57, 0xef, 0x19,
|
||||
0x68, 0x78, 0x56, 0xb4, 0xce, 0x73, 0xf5, 0xf9, 0x8e, 0xf6, 0x50, 0x7b,
|
||||
0xdd, 0x4f, 0x1a, 0xa5,
|
||||
0xc7, 0x66, 0xbd, 0xef, 0x1f, 0xc2, 0x63, 0x4e, 0xb9, 0xe9, 0x58, 0x69,
|
||||
0xb5, 0x95, 0xa9, 0xad,
|
||||
0x56, 0xac, 0x7c, 0xab, 0xcf, 0x6f, 0x04, 0x19, 0xaf, 0x68, 0x29, 0x3f,
|
||||
0xde, 0xe2, 0x7e, 0x5a,
|
||||
0xb9, 0x4c, 0x3f, 0xf3, 0x3b, 0x13, 0x50, 0x17, 0x56, 0xbc, 0x47, 0xb5,
|
||||
0x41, 0x2d, 0x44, 0x54,
|
||||
0x0d, 0x31, 0x6d, 0xd6, 0x2d, 0xa5, 0x6b, 0x55, 0x46, 0x6a, 0xba, 0x91,
|
||||
0xa6, 0xdf, 0x1e, 0x3a,
|
||||
0x8a, 0x5d, 0xcf, 0x07, 0xc4, 0x05, 0x0d, 0xf5, 0xde, 0xc9, 0x3b, 0xfa,
|
||||
0x0d, 0x95, 0xb7, 0xdc,
|
||||
0x2d, 0x6f, 0x5a, 0x70, 0x41, 0xbf, 0xe1, 0x63, 0x1d, 0xff, 0xa6, 0x7e,
|
||||
0x8b, 0xc7, 0x35, 0x47,
|
||||
0xfd, 0xff, 0x96, 0xdf, 0x28, 0x5f, 0xfa, 0x6f, 0x06, 0xa5, 0x76, 0x3e,
|
||||
0xe0, 0x5a, 0x17, 0x7c,
|
||||
0xd6, 0xf1, 0xef, 0xbb, 0x12, 0xde, 0xde, 0x72, 0x23, 0xd8, 0xac, 0x60,
|
||||
0xdc, 0xb6, 0xa5, 0x74,
|
||||
0xb9, 0xf1, 0xde, 0x15, 0x5d, 0xda, 0x78, 0x47, 0x6b, 0xe3, 0xc2, 0x65,
|
||||
0xe8, 0x9f, 0x97, 0x0f,
|
||||
0xc9, 0x64, 0x54, 0x2a, 0x46, 0xa6, 0x0c, 0xf6, 0xd8, 0xcc, 0xbd, 0xa7,
|
||||
0x65, 0xda, 0x93, 0x1d,
|
||||
0xc9, 0xd8, 0xcc, 0x2e, 0x9f, 0x6a, 0x5a, 0x21, 0xfc, 0x56, 0xf0, 0x29,
|
||||
0xf5, 0x21, 0xb5, 0x17,
|
||||
0x31, 0x35, 0xb0, 0xc6, 0x6b, 0xb3, 0x6e, 0xb3, 0xba, 0x46, 0x8c, 0x74,
|
||||
0x8c, 0xb1, 0xab, 0x9d,
|
||||
0x31, 0x82, 0xea, 0xe9, 0x22, 0xf1, 0xf8, 0xf3, 0xe1, 0x03, 0xf9, 0x38,
|
||||
0xf4, 0x4d, 0x11, 0xd7,
|
||||
0x80, 0xef, 0xd8, 0xc5, 0xe3, 0x24, 0xd1, 0x18, 0x23, 0x03, 0x2c, 0x71,
|
||||
0xa6, 0xce, 0x69, 0xb7,
|
||||
0x97, 0x8f, 0x49, 0x8b, 0x33, 0xe2, 0xe8, 0x7d, 0x41, 0x56, 0xc9, 0xd7,
|
||||
0xf2, 0x2f, 0x74, 0xfd,
|
||||
0x73, 0xe0, 0x13, 0x72, 0xc0, 0x0a, 0x7d, 0xaf, 0x2e, 0x84, 0x9f, 0x86,
|
||||
0x4d, 0xfa, 0x6f, 0x3d,
|
||||
0xe3, 0x8c, 0x44, 0xe9, 0x67, 0xb5, 0x19, 0xe8, 0x3a, 0xed, 0xb1, 0x98,
|
||||
0x04, 0x7b, 0xb4, 0x43,
|
||||
0xfd, 0x65, 0xe4, 0x10, 0x2a, 0x8c, 0x6f, 0x88, 0x8e, 0x8f, 0xae, 0x19,
|
||||
0x17, 0xc9, 0xc6, 0x71,
|
||||
0x32, 0x8c, 0xda, 0x3e, 0x84, 0x9f, 0x8e, 0xd1, 0x54, 0xdf, 0xd1, 0xc4,
|
||||
0x53, 0x9f, 0xda, 0xb0,
|
||||
0x78, 0x9f, 0xef, 0x9a, 0x20, 0x3f, 0xf6, 0x2d, 0x88, 0xc9, 0x55, 0xdf,
|
||||
0xa4, 0x13, 0x81, 0x96,
|
||||
0xd7, 0x49, 0xab, 0x7c, 0x46, 0x2e, 0xbd, 0x16, 0xa8, 0x68, 0x4d, 0x22,
|
||||
0x6e, 0x23, 0x43, 0xb8,
|
||||
0x76, 0x18, 0xd1, 0xf2, 0x4c, 0x6d, 0x58, 0x82, 0xff, 0xf7, 0xff, 0x75,
|
||||
0x9d, 0x34, 0x78, 0x4c,
|
||||
0xa4, 0xe1, 0xfa, 0xe6, 0xaa, 0x7e, 0x9c, 0xad, 0xd4, 0x77, 0xc4, 0x7d,
|
||||
0xfe, 0x13, 0x71, 0x51,
|
||||
0x7e, 0xe4, 0x3c, 0x38, 0x44, 0x46, 0xb8, 0xbf, 0x0b, 0x2b, 0xd2, 0x1e,
|
||||
0xe9, 0x08, 0x5d, 0xd7,
|
||||
0x70, 0xd9, 0xa2, 0x1c, 0x6d, 0x6c, 0xa6, 0x63, 0x2d, 0x7c, 0xd4, 0x73,
|
||||
0x32, 0xca, 0xfe, 0x82,
|
||||
0x28, 0x0c, 0xe4, 0x04, 0xf8, 0xa5, 0xfe, 0x0b, 0xba, 0x2f, 0xae, 0x1a,
|
||||
0xdf, 0x32, 0x6f, 0x89,
|
||||
0x0c, 0xc6, 0x62, 0x8a, 0xd2, 0x8b, 0xf6, 0x91, 0xd2, 0xab, 0xac, 0x57,
|
||||
0x7a, 0xaf, 0xf2, 0x5f,
|
||||
0xfb, 0x7a, 0x2a, 0xbd, 0x7b, 0x45, 0xf7, 0xb4, 0xee, 0xe5, 0xbd, 0xd2,
|
||||
0x2e, 0x37, 0xb6, 0x67,
|
||||
0x39, 0xe3, 0x18, 0xdb, 0xd3, 0x6c, 0x7b, 0x32, 0xfd, 0x91, 0xca, 0x47,
|
||||
0x52, 0x1f, 0xa9, 0xe8,
|
||||
0xc1, 0xdc, 0x9e, 0xf4, 0xf7, 0xcc, 0xe8, 0xf9, 0x4b, 0xca, 0x54, 0xd6,
|
||||
0x3b, 0xfd, 0xe1, 0xba,
|
||||
0xf0, 0x98, 0x40, 0xdf, 0xb5, 0x19, 0x36, 0xe9, 0xd9, 0xa4, 0x17, 0xec,
|
||||
0xc3, 0x1d, 0xc3, 0x65,
|
||||
0xb8, 0x0c, 0x92, 0x01, 0xd4, 0x23, 0xea, 0xef, 0x51, 0xbf, 0xba, 0x0a,
|
||||
0xa8, 0xbf, 0x83, 0x3d,
|
||||
0x2b, 0x29, 0xd2, 0x87, 0x0c, 0x0b, 0x15, 0x03, 0xbb, 0x95, 0xdd, 0x93,
|
||||
0xde, 0xb5, 0x21, 0x2c,
|
||||
0x22, 0x2c, 0x74, 0x5d, 0xf3, 0x15, 0xf0, 0xfb, 0x36, 0x89, 0xb5, 0x5e,
|
||||
0x05, 0x2f, 0xd8, 0x86,
|
||||
0x1a, 0x43, 0xf5, 0x77, 0x04, 0x3c, 0xad, 0x9f, 0x98, 0xb4, 0xea, 0xbf,
|
||||
0x66, 0xfd, 0xe6, 0x32,
|
||||
0xf8, 0xd6, 0xfd, 0x2d, 0xaa, 0xd5, 0xd8, 0x6b, 0xa0, 0x0c, 0xd5, 0x18,
|
||||
0x0e, 0x9d, 0xbb, 0x66,
|
||||
0x86, 0x8f, 0x0e, 0x7d, 0x33, 0xe6, 0xf5, 0xfd, 0x5e, 0xdb, 0xae, 0x75,
|
||||
0xff, 0x88, 0x1b, 0x6a,
|
||||
0x1b, 0x22, 0xcf, 0x81, 0xc1, 0xc4, 0x5a, 0x0f, 0xf6, 0xb7, 0x55, 0x3a,
|
||||
0x4f, 0xba, 0x6c, 0xd7,
|
||||
0xf6, 0x1b, 0xa4, 0x3d, 0xdf, 0x4f, 0x7c, 0x58, 0xf2, 0x19, 0xdd, 0x97,
|
||||
0x59, 0x6a, 0xee, 0x73,
|
||||
0xf6, 0x61, 0x8e, 0xbe, 0x13, 0xc3, 0x93, 0xc2, 0xab, 0x43, 0xdf, 0x6f,
|
||||
0x7b, 0xdd, 0xbf, 0xdb,
|
||||
0x96, 0x58, 0xbb, 0xb3, 0xe2, 0xd9, 0xd4, 0x21, 0xf6, 0x41, 0x0e, 0xd7,
|
||||
0x37, 0x32, 0xf4, 0x97,
|
||||
0xa7, 0xa8, 0x4a, 0xb2, 0x65, 0x99, 0xbc, 0x1d, 0xf0, 0x6f, 0xf9, 0x2f,
|
||||
0xca, 0x3e, 0xa9, 0x60,
|
||||
0xf7, 0x7a, 0x52, 0x47, 0x98, 0x9e, 0x63, 0x0c, 0x96, 0xa1, 0xc5, 0x0f,
|
||||
0x67, 0x87, 0xcf, 0xea,
|
||||
0x36, 0x2a, 0xa4, 0xd1, 0x5f, 0x26, 0xd6, 0xc2, 0x67, 0x85, 0x47, 0x3c,
|
||||
0x58, 0x3c, 0x30, 0x7b,
|
||||
0xa0, 0x7d, 0x80, 0x0c, 0x70, 0x7f, 0xf7, 0xf0, 0x33, 0xd8, 0xe4, 0x31,
|
||||
0x79, 0x1c, 0xdb, 0x64,
|
||||
0x4a, 0x91, 0x4c, 0x90, 0x49, 0x52, 0xc6, 0x19, 0x3d, 0x9a, 0xfc, 0xf9,
|
||||
0x88, 0x74, 0x97, 0xde,
|
||||
0xc4, 0x97, 0x7b, 0xac, 0xf1, 0xac, 0x0c, 0xca, 0x7f, 0xca, 0x76, 0x9b,
|
||||
0x33, 0x3c, 0xa2, 0x5b,
|
||||
0x28, 0xc6, 0x7e, 0x59, 0xbb, 0x39, 0x6f, 0x8d, 0x78, 0xb4, 0x70, 0x60,
|
||||
0xee, 0xb3, 0xf6, 0xfe,
|
||||
0xe2, 0x85, 0x7a, 0x7a, 0xd7, 0x5b, 0x7a, 0x49, 0x4f, 0x62, 0xaf, 0x27,
|
||||
0x9f, 0x9e, 0xd1, 0xdf,
|
||||
0x28, 0x6d, 0x02, 0x1b, 0x0f, 0x32, 0x7a, 0x19, 0xf7, 0xcc, 0x08, 0x8f,
|
||||
0x0a, 0xd9, 0xeb, 0xd7,
|
||||
0x8a, 0xb7, 0x6e, 0xa3, 0x1e, 0x1c, 0xff, 0x74, 0x66, 0x7f, 0x5b, 0xbf,
|
||||
0xfc, 0xbe, 0x46, 0x5f,
|
||||
0x09, 0x0a, 0xfa, 0xfa, 0xd9, 0xfa, 0x3b, 0xfa, 0x16, 0x3e, 0x9e, 0x7b,
|
||||
0x47, 0x7d, 0xd8, 0xe8,
|
||||
0x50, 0x4e, 0xfc, 0xd5, 0xf3, 0xe4, 0xa8, 0x3b, 0x26, 0x3f, 0x9c, 0xd0,
|
||||
0xd3, 0x20, 0xca, 0xf2,
|
||||
0xfa, 0xe6, 0xf7, 0xb5, 0xf7, 0x71, 0xf4, 0x31, 0xfa, 0x88, 0xbe, 0xec,
|
||||
0x7d, 0x1d, 0x7d, 0x6d,
|
||||
0xfd, 0x1c, 0xfd, 0xed, 0xcf, 0x38, 0x9e, 0xa8, 0xbc, 0x2f, 0x45, 0xed,
|
||||
0x85, 0xa1, 0xf8, 0xfa,
|
||||
0x6d, 0xd8, 0x4d, 0xd9, 0x22, 0xac, 0xa1, 0xdb, 0xa8, 0x3b, 0x6a, 0xef,
|
||||
0x8f, 0x7f, 0xa8, 0xf4,
|
||||
0xb1, 0x8c, 0x7f, 0x16, 0xf6, 0x18, 0xdb, 0xa3, 0xb0, 0x7b, 0xee, 0xe3,
|
||||
0xe3, 0xff, 0x91, 0xf5,
|
||||
0xc0, 0xa4, 0xbb, 0x93, 0x6e, 0x65, 0xff, 0x53, 0x7b, 0x60, 0xb7, 0x50,
|
||||
0x7c, 0xfd, 0x26, 0x6d,
|
||||
0x17, 0xde, 0xc0, 0xd5, 0x88, 0x8d, 0xd4, 0xa5, 0x3e, 0x63, 0xa7, 0x90,
|
||||
0xad, 0x42, 0x08, 0x21,
|
||||
0x30, 0xfe, 0x1f, 0x7e, 0x26, 0xe7, 0x5b
|
||||
};
|
369
source/ngc/dvd.cpp
Normal file
369
source/ngc/dvd.cpp
Normal file
@ -0,0 +1,369 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube DVD
|
||||
*
|
||||
* softdev July 2006
|
||||
* svpe & crunchy2 June 2007
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dvd.h>
|
||||
#include "snes9xGx.h"
|
||||
|
||||
/** DVD I/O Address base **/
|
||||
volatile unsigned long *dvd = (volatile unsigned long *) 0xCC006000;
|
||||
|
||||
/** Due to lack of memory, we'll use this little 2k keyhole for all DVD operations **/
|
||||
unsigned char DVDreadbuffer[2048] ATTRIBUTE_ALIGN (32);
|
||||
unsigned char dvdbuffer[2048];
|
||||
|
||||
/**
|
||||
* dvd_driveid
|
||||
*
|
||||
* Gets and returns the dvd driveid
|
||||
**/
|
||||
static unsigned char *inquiry=(unsigned char *)0x80000004;
|
||||
|
||||
int dvd_driveid()
|
||||
{
|
||||
dvd[0] = 0x2e;
|
||||
dvd[1] = 0;
|
||||
dvd[2] = 0x12000000;
|
||||
dvd[3] = 0;
|
||||
dvd[4] = 0x20;
|
||||
dvd[5] = 0x80000000;
|
||||
dvd[6] = 0x20;
|
||||
dvd[7] = 3;
|
||||
|
||||
while( dvd[7] & 1 )
|
||||
;
|
||||
DCFlushRange((void *)0x80000000, 32);
|
||||
|
||||
return (int)inquiry[2];
|
||||
}
|
||||
|
||||
/**
|
||||
* dvd_read
|
||||
*
|
||||
* The only DVD function we need - you gotta luv gc-linux self-boots!
|
||||
*/
|
||||
int
|
||||
dvd_read (void *dst, unsigned int len, u64 offset)
|
||||
{
|
||||
|
||||
unsigned char *buffer = (unsigned char *) (unsigned int) DVDreadbuffer;
|
||||
|
||||
if (len > 2048)
|
||||
return 1; /*** We only allow 2k reads **/
|
||||
|
||||
DCInvalidateRange ((void *) buffer, len);
|
||||
|
||||
if(offset < 0x57057C00 || (isWii == true && offset < 0x118244F00LL)) // don't read past the end of the DVD
|
||||
{
|
||||
offset >>= 2;
|
||||
dvd[0] = 0x2E;
|
||||
dvd[1] = 0;
|
||||
dvd[2] = 0xA8000000;
|
||||
dvd[3] = (u32)offset;
|
||||
dvd[4] = len;
|
||||
dvd[5] = (unsigned long) buffer;
|
||||
dvd[6] = len;
|
||||
dvd[7] = 3; /*** Enable reading with DMA ***/
|
||||
while (dvd[7] & 1);
|
||||
memcpy (dst, buffer, len);
|
||||
}
|
||||
else // Let's not read past end of DVD
|
||||
return 0;
|
||||
|
||||
if (dvd[0] & 0x4) /* Ensure it has completed */
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/** Minimal ISO Directory Definition **/
|
||||
#define RECLEN 0 /* Record length */
|
||||
#define EXTENT 6 /* Extent */
|
||||
#define FILE_LENGTH 14 /* File length (BIG ENDIAN) */
|
||||
#define FILE_FLAGS 25 /* File flags */
|
||||
#define FILENAME_LENGTH 32 /* Filename length */
|
||||
#define FILENAME 33 /* ASCIIZ filename */
|
||||
|
||||
/** Minimal Primary Volume Descriptor **/
|
||||
#define PVDROOT 0x9c
|
||||
static int IsJoliet = 0;
|
||||
u64 rootdir = 0;
|
||||
int rootdirlength = 0;
|
||||
|
||||
/** Global file entry table **/
|
||||
FILEENTRIES filelist[MAXFILES];
|
||||
|
||||
/**
|
||||
* Primary Volume Descriptor
|
||||
*
|
||||
* The PVD should reside between sector 16 and 31.
|
||||
* This is for single session DVD only.
|
||||
*/
|
||||
int
|
||||
getpvd ()
|
||||
{
|
||||
int sector = 16;
|
||||
u32 rootdir32;
|
||||
|
||||
rootdir = rootdirlength = 0;
|
||||
IsJoliet = -1;
|
||||
|
||||
/** Look for Joliet PVD first **/
|
||||
while (sector < 32)
|
||||
{
|
||||
if (dvd_read (dvdbuffer, 2048, (u64)(sector << 11)))
|
||||
{
|
||||
if (memcmp (&dvdbuffer, "\2CD001\1", 8) == 0)
|
||||
{
|
||||
memcpy(&rootdir32, &dvdbuffer[PVDROOT + EXTENT], 4);
|
||||
rootdir = (u64)rootdir32;
|
||||
rootdir <<= 11;
|
||||
memcpy (&rootdirlength, &dvdbuffer[PVDROOT + FILE_LENGTH], 4);
|
||||
IsJoliet = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
return 0; /*** Can't read sector! ***/
|
||||
|
||||
sector++;
|
||||
}
|
||||
|
||||
if (IsJoliet > 0) /*** Joliet PVD Found ? ***/
|
||||
return 1;
|
||||
|
||||
sector = 16;
|
||||
|
||||
/*** Look for standard ISO9660 PVD ***/
|
||||
while (sector < 32)
|
||||
{
|
||||
if (dvd_read (&dvdbuffer, 2048, sector << 11))
|
||||
{
|
||||
if (memcmp (&dvdbuffer, "\1CD001\1", 8) == 0)
|
||||
{
|
||||
memcpy (&rootdir32, &dvdbuffer[PVDROOT + EXTENT], 4);
|
||||
rootdir = (u64)rootdir32;
|
||||
rootdir <<= 11;
|
||||
memcpy (&rootdirlength, &dvdbuffer[PVDROOT + FILE_LENGTH], 4);
|
||||
IsJoliet = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
return 0; /*** Can't read sector! ***/
|
||||
|
||||
sector++;
|
||||
|
||||
}
|
||||
|
||||
return (IsJoliet == 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* getentry
|
||||
*
|
||||
* Support function to return the next file entry, if any
|
||||
* Declared static to avoid accidental external entry.
|
||||
*/
|
||||
static int diroffset = 0;
|
||||
static int
|
||||
getentry (int entrycount)
|
||||
{
|
||||
char fname[512]; /* Huge, but experience has determined this */
|
||||
char *ptr;
|
||||
char *filename;
|
||||
char *filenamelength;
|
||||
char *rr;
|
||||
int j;
|
||||
u32 offset32;
|
||||
|
||||
/* Basic checks */
|
||||
if (entrycount >= MAXFILES)
|
||||
return 0;
|
||||
|
||||
if (diroffset >= 2048)
|
||||
return 0;
|
||||
|
||||
/** Decode this entry **/
|
||||
if (dvdbuffer[diroffset]) /* Record length available */
|
||||
{
|
||||
/* Update offsets into sector buffer */
|
||||
ptr = (char *) &dvdbuffer[0];
|
||||
ptr += diroffset;
|
||||
filename = ptr + FILENAME;
|
||||
filenamelength = ptr + FILENAME_LENGTH;
|
||||
|
||||
/* Check for wrap round - illegal in ISO spec,
|
||||
* but certain crap writers do it! */
|
||||
if ((diroffset + dvdbuffer[diroffset]) > 2048)
|
||||
return 0;
|
||||
|
||||
if (*filenamelength)
|
||||
{
|
||||
memset (&fname, 0, 512);
|
||||
|
||||
if (!IsJoliet) /*** Do ISO 9660 first ***/
|
||||
strcpy (fname, filename);
|
||||
else
|
||||
{ /*** The more tortuous unicode joliet entries ***/
|
||||
|
||||
for (j = 0; j < (*filenamelength >> 1); j++)
|
||||
{
|
||||
fname[j] = filename[j * 2 + 1];
|
||||
}
|
||||
|
||||
fname[j] = 0;
|
||||
|
||||
if (strlen (fname) >= MAXJOLIET)
|
||||
fname[MAXJOLIET] = 0;
|
||||
|
||||
if (strlen (fname) == 0)
|
||||
fname[0] = filename[0];
|
||||
}
|
||||
|
||||
if (strlen (fname) == 0)
|
||||
strcpy (fname, "ROOT");
|
||||
else
|
||||
{
|
||||
if (fname[0] == 1)
|
||||
strcpy (fname, "..");
|
||||
else
|
||||
{ /*
|
||||
* Move *filenamelength to t,
|
||||
* Only to stop gcc warning for noobs :)
|
||||
*/
|
||||
int t = *filenamelength;
|
||||
fname[t] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** Rockridge Check **/
|
||||
rr = strstr (fname, ";");
|
||||
if (rr != NULL)
|
||||
*rr = 0;
|
||||
|
||||
strcpy (filelist[entrycount].filename, fname);
|
||||
fname[MAXDISPLAY] = 0;
|
||||
strcpy (filelist[entrycount].displayname, fname);
|
||||
|
||||
memcpy (&offset32,
|
||||
&dvdbuffer[diroffset + EXTENT], 4);
|
||||
filelist[entrycount].offset = (u64)offset32;
|
||||
memcpy (&filelist[entrycount].length,
|
||||
&dvdbuffer[diroffset + FILE_LENGTH], 4);
|
||||
memcpy (&filelist[entrycount].flags,
|
||||
&dvdbuffer[diroffset + FILE_FLAGS], 1);
|
||||
|
||||
filelist[entrycount].offset <<= 11;
|
||||
filelist[entrycount].flags = filelist[entrycount].flags & 2;
|
||||
|
||||
/*** Prepare for next entry ***/
|
||||
diroffset += dvdbuffer[diroffset];
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* parsedirectory
|
||||
*
|
||||
* This function will parse the directory tree.
|
||||
* It relies on rootdir and rootdirlength being pre-populated by a call to
|
||||
* getpvd, a previous parse or a menu selection.
|
||||
*
|
||||
* The return value is number of files collected, or 0 on failure.
|
||||
*/
|
||||
int
|
||||
parsedirectory ()
|
||||
{
|
||||
int pdlength;
|
||||
u64 pdoffset;
|
||||
u64 rdoffset;
|
||||
int len = 0;
|
||||
int filecount = 0;
|
||||
|
||||
pdoffset = rdoffset = rootdir;
|
||||
pdlength = rootdirlength;
|
||||
filecount = 0;
|
||||
|
||||
/*** Clear any existing values ***/
|
||||
memset (&filelist, 0, sizeof (FILEENTRIES) * MAXFILES);
|
||||
|
||||
/*** Get as many files as possible ***/
|
||||
while (len < pdlength)
|
||||
{
|
||||
if (dvd_read (&dvdbuffer, 2048, pdoffset) == 0)
|
||||
return 0;
|
||||
|
||||
diroffset = 0;
|
||||
|
||||
while (getentry (filecount))
|
||||
{
|
||||
if (filecount < MAXFILES)
|
||||
filecount++;
|
||||
}
|
||||
|
||||
len += 2048;
|
||||
pdoffset = rdoffset + len;
|
||||
}
|
||||
|
||||
return filecount;
|
||||
}
|
||||
/****************************************************************************
|
||||
* uselessinquiry
|
||||
*
|
||||
* As the name suggests, this function is quite useless.
|
||||
* It's only purpose is to stop any pending DVD interrupts while we use the
|
||||
* memcard interface.
|
||||
*
|
||||
* libOGC tends to foul up if you don't, and sometimes does if you do!
|
||||
****************************************************************************/
|
||||
void uselessinquiry ()
|
||||
{
|
||||
|
||||
dvd[0] = 0;
|
||||
dvd[1] = 0;
|
||||
dvd[2] = 0x12000000;
|
||||
dvd[3] = 0;
|
||||
dvd[4] = 0x20;
|
||||
dvd[5] = 0x80000000;
|
||||
dvd[6] = 0x20;
|
||||
dvd[7] = 1;
|
||||
|
||||
while (dvd[7] & 1);
|
||||
}
|
||||
|
||||
void dvd_motor_off( )
|
||||
{
|
||||
dvd[0] = 0x2e;
|
||||
dvd[1] = 0;
|
||||
dvd[2] = 0xe3000000;
|
||||
dvd[3] = 0;
|
||||
dvd[4] = 0;
|
||||
dvd[5] = 0;
|
||||
dvd[6] = 0;
|
||||
dvd[7] = 1; // Do immediate
|
||||
while (dvd[7] & 1);
|
||||
|
||||
/*** PSO Stops blackscreen at reload ***/
|
||||
dvd[0] = 0x14;
|
||||
dvd[1] = 0;
|
||||
}
|
||||
|
37
source/ngc/dvd.h
Normal file
37
source/ngc/dvd.h
Normal file
@ -0,0 +1,37 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube DVD
|
||||
*
|
||||
* softdev July 2006
|
||||
* svpe & crunchy2 June 2007
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _NGCDVD_
|
||||
#define _NGCDVD_
|
||||
|
||||
#define MAXJOLIET 255
|
||||
#define MAXDISPLAY 54
|
||||
typedef struct
|
||||
{
|
||||
u64 offset;
|
||||
unsigned int length;
|
||||
char flags;
|
||||
char filename[MAXJOLIET + 1];
|
||||
char displayname[MAXDISPLAY + 1];
|
||||
} FILEENTRIES;
|
||||
|
||||
extern u64 rootdir;
|
||||
extern int rootdirlength;
|
||||
#define MAXFILES 2000 /** Restrict to 2000 files per dir **/
|
||||
|
||||
extern int getpvd ();
|
||||
extern int parsedirectory ();
|
||||
extern FILEENTRIES filelist[MAXFILES];
|
||||
|
||||
int dvd_driveid();
|
||||
|
||||
int dvd_read (void *dst, unsigned int len, u64 offset);
|
||||
extern void dvd_motor_off ();
|
||||
|
||||
#endif
|
474
source/ngc/filesel.cpp
Normal file
474
source/ngc/filesel.cpp
Normal file
@ -0,0 +1,474 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Filesel - borrowed from GPP
|
||||
*
|
||||
* softdev July 2006
|
||||
* svpe June 2007
|
||||
* crunchy2 May-July 2007
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "debug.h"
|
||||
#include "cpuexec.h"
|
||||
#include "ppu.h"
|
||||
#include "apu.h"
|
||||
#include "display.h"
|
||||
#include "gfx.h"
|
||||
#include "soundux.h"
|
||||
#include "spc700.h"
|
||||
#include "spc7110.h"
|
||||
#include "controls.h"
|
||||
|
||||
#include "snes9xGx.h"
|
||||
#include "dvd.h"
|
||||
#include "ftfont.h"
|
||||
#include "video.h"
|
||||
#include "aram.h"
|
||||
#include "ngcunzip.h"
|
||||
#include "filesel.h"
|
||||
#include "smbload.h"
|
||||
#include "sdload.h"
|
||||
#include "mcsave.h"
|
||||
|
||||
#define PAGESIZE 17
|
||||
static int maxfiles;
|
||||
int havedir = 0;
|
||||
int hasloaded = 0;
|
||||
int loadtype = 0;
|
||||
int LoadDVDFile (unsigned char *buffer);
|
||||
int haveSDdir = 0;
|
||||
extern unsigned long ARAM_ROMSIZE;
|
||||
extern int screenheight;
|
||||
|
||||
/**
|
||||
* Showfile screen
|
||||
*
|
||||
* Display the file selection to the user
|
||||
*/
|
||||
static void
|
||||
ShowFiles (int offset, int selection)
|
||||
{
|
||||
int i, j;
|
||||
char text[80];
|
||||
int ypos;
|
||||
int w;
|
||||
|
||||
clearscreen ();
|
||||
|
||||
setfontsize (16);
|
||||
|
||||
ypos = (screenheight - ((PAGESIZE - 1) * 20)) >> 1;
|
||||
|
||||
if (screenheight == 480)
|
||||
ypos += 24;
|
||||
else
|
||||
ypos += 10;
|
||||
|
||||
j = 0;
|
||||
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
|
||||
|
||||
{
|
||||
if (filelist[i].flags)
|
||||
|
||||
{
|
||||
strcpy (text, "[");
|
||||
strcat (text, filelist[i].displayname);
|
||||
strcat (text, "]");
|
||||
}
|
||||
|
||||
else
|
||||
strcpy (text, filelist[i].displayname);
|
||||
if (j == (selection - offset))
|
||||
|
||||
{
|
||||
|
||||
/*** Highlighted text entry ***/
|
||||
for ( w = 0; w < 20; w++ )
|
||||
DrawLineFast( 30, 610, ( j * 20 ) + (ypos-16) + w, 0x80, 0x80, 0x80 );
|
||||
|
||||
setfontcolour (0x00, 0x00, 0xe0);
|
||||
DrawText (-1, (j * 20) + ypos, text);
|
||||
setfontcolour (0x00, 0x00, 0x00);
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
/*** Normal entry ***/
|
||||
DrawText (-1, (j * 20) + ypos, text);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
showscreen ();
|
||||
|
||||
setfontsize (24);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* SNESROMSOffset
|
||||
*
|
||||
* Function to check for and return offset to a directory called SNESROMS, if
|
||||
* any
|
||||
*/
|
||||
int SNESROMSOffset()
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < maxfiles; i++ )
|
||||
if (strcmp(filelist[i].filename, "SNESROMS") == 0)
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* FileSelector
|
||||
*
|
||||
* Let user select a file from the DVD listing
|
||||
*/
|
||||
int offset = 0;
|
||||
int selection = 0;
|
||||
|
||||
#define PADCAL 40
|
||||
int
|
||||
FileSelector ()
|
||||
{
|
||||
short p;
|
||||
signed char a;
|
||||
int haverom = 0;
|
||||
int redraw = 1;
|
||||
int selectit = 0;
|
||||
|
||||
while (haverom == 0)
|
||||
{
|
||||
if (redraw)
|
||||
ShowFiles (offset, selection);
|
||||
redraw = 0;
|
||||
p = PAD_ButtonsDown (0);
|
||||
a = PAD_StickY (0);
|
||||
if ((p & PAD_BUTTON_A) || selectit)
|
||||
{
|
||||
if ( selectit )
|
||||
selectit = 0;
|
||||
if (filelist[selection].flags) /*** This is directory ***/
|
||||
{
|
||||
if (loadtype == LOAD_SDC)
|
||||
{
|
||||
/* memorize last entries list, actual root directory and selection for next access */
|
||||
haveSDdir = 1;
|
||||
|
||||
/* update current directory and set new entry list if directory has changed */
|
||||
int status = updateSDdirname();
|
||||
if (status == 1)
|
||||
{
|
||||
maxfiles = parseSDdirectory();
|
||||
if (!maxfiles)
|
||||
{
|
||||
WaitPrompt ("Error reading directory !");
|
||||
haverom = 1; // quit SD menu
|
||||
haveSDdir = 0; // reset everything at next access
|
||||
}
|
||||
}
|
||||
else if (status == -1)
|
||||
{
|
||||
haverom = 1; // quit SD menu
|
||||
haveSDdir = 0; // reset everything at next access
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (strcmp (filelist[selection].filename, "..") == 0)
|
||||
&& ((unsigned int)rootdir == filelist[selection].offset) )
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
rootdir = filelist[selection].offset;
|
||||
rootdirlength = filelist[selection].length;
|
||||
offset = selection = 0;
|
||||
maxfiles = parsedirectory ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rootdir = filelist[selection].offset;
|
||||
rootdirlength = filelist[selection].length;
|
||||
|
||||
switch (loadtype)
|
||||
{
|
||||
case LOAD_DVD:
|
||||
/*** Now load the DVD file to it's offset ***/
|
||||
ARAM_ROMSIZE = LoadDVDFile (Memory.ROM);
|
||||
break;
|
||||
|
||||
case LOAD_SMB:
|
||||
/*** Load from SMB ***/
|
||||
ARAM_ROMSIZE =
|
||||
LoadSMBFile (filelist[selection].filename,
|
||||
filelist[selection].length);
|
||||
break;
|
||||
|
||||
case LOAD_SDC:
|
||||
/*** Load from SD Card ***/
|
||||
/* memorize last entries list, actual root directory and selection for next access */
|
||||
haveSDdir = 1;
|
||||
ARAM_ROMSIZE = LoadSDFile (filelist[selection].filename,
|
||||
filelist[selection].length);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ARAM_ROMSIZE > 0)
|
||||
{
|
||||
hasloaded = 1;
|
||||
Memory.LoadROM ("BLANK.SMC");
|
||||
|
||||
Memory.LoadSRAM ("BLANK");
|
||||
haverom = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt("Error loading ROM!");
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
}
|
||||
if ( p & PAD_BUTTON_B )
|
||||
{
|
||||
while ( PAD_ButtonsDown(0) & PAD_BUTTON_B )
|
||||
VIDEO_WaitVSync();
|
||||
if ((strcmp(filelist[1].filename,"..") == 0) && (strlen (filelist[0].filename) != 0))
|
||||
selection = selectit = 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if ((p & PAD_BUTTON_DOWN) || (a < -PADCAL))
|
||||
{
|
||||
selection++;
|
||||
if (selection == maxfiles)
|
||||
selection = offset = 0;
|
||||
if ((selection - offset) >= PAGESIZE)
|
||||
offset += PAGESIZE;
|
||||
redraw = 1;
|
||||
} // End of down
|
||||
if ((p & PAD_BUTTON_UP) || (a > PADCAL))
|
||||
{
|
||||
selection--;
|
||||
if (selection < 0)
|
||||
{
|
||||
selection = maxfiles - 1;
|
||||
offset = selection - PAGESIZE + 1;
|
||||
}
|
||||
if (selection < offset)
|
||||
offset -= PAGESIZE;
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
redraw = 1;
|
||||
} // End of Up
|
||||
if (PAD_ButtonsHeld (0) & PAD_BUTTON_LEFT)
|
||||
{
|
||||
/*** Go back a page ***/
|
||||
selection -= PAGESIZE;
|
||||
if (selection < 0)
|
||||
{
|
||||
selection = maxfiles - 1;
|
||||
offset = selection - PAGESIZE + 1;
|
||||
}
|
||||
if (selection < offset)
|
||||
offset -= PAGESIZE;
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
redraw = 1;
|
||||
}
|
||||
if (PAD_ButtonsHeld (0) & PAD_BUTTON_RIGHT)
|
||||
{
|
||||
/*** Go forward a page ***/
|
||||
selection += PAGESIZE;
|
||||
if (selection > maxfiles - 1)
|
||||
selection = offset = 0;
|
||||
if ((selection - offset) >= PAGESIZE)
|
||||
offset += PAGESIZE;
|
||||
redraw = 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* OpenDVD
|
||||
*
|
||||
* Function to load a DVD directory and display to user.
|
||||
*/
|
||||
int
|
||||
OpenDVD ()
|
||||
{
|
||||
int romsdiroffset = 0;
|
||||
|
||||
loadtype = LOAD_DVD;
|
||||
|
||||
if (!getpvd())
|
||||
{
|
||||
ShowAction("Mounting DVD ... Wait");
|
||||
DVD_Mount(); /* mount the DVD unit again */
|
||||
havedir = 0; /* this may be a new DVD: content need to be parsed again */
|
||||
if (!getpvd())
|
||||
return 0; /* no correct ISO9660 DVD */
|
||||
}
|
||||
|
||||
if (havedir == 0)
|
||||
{
|
||||
offset = selection = 0; /* reset file selector */
|
||||
haveSDdir = 0; /* prevent conflicts with SDCARD file selector */
|
||||
|
||||
if ((maxfiles = parsedirectory ()))
|
||||
{
|
||||
if ( romsdiroffset = SNESROMSOffset() )
|
||||
{
|
||||
rootdir = filelist[romsdiroffset].offset;
|
||||
rootdirlength = filelist[romsdiroffset].length;
|
||||
offset = selection = 0;
|
||||
maxfiles = parsedirectory ();
|
||||
}
|
||||
|
||||
int ret = FileSelector ();
|
||||
havedir = 1;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
return FileSelector ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* OpenSMB
|
||||
*
|
||||
* Function to load from an SMB share
|
||||
*/
|
||||
int
|
||||
OpenSMB ()
|
||||
{
|
||||
loadtype = LOAD_SMB;
|
||||
|
||||
if ((maxfiles = parseSMBDirectory ()))
|
||||
{
|
||||
char txt[80];
|
||||
sprintf(txt,"maxfiles = %d", maxfiles);
|
||||
|
||||
return FileSelector ();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* OpenSD
|
||||
*
|
||||
* Function to load from an SD Card
|
||||
*/
|
||||
int
|
||||
OpenSD (int slot)
|
||||
{
|
||||
char msg[80];
|
||||
|
||||
loadtype = LOAD_SDC;
|
||||
|
||||
if (haveSDdir == 0)
|
||||
{
|
||||
/* don't mess with DVD entries */
|
||||
havedir = 0;
|
||||
|
||||
/* Initialise libOGC SD functions */
|
||||
SDCARD_Init ();
|
||||
|
||||
/* Reset SDCARD root directory */
|
||||
sprintf(rootSDdir,"dev%d:\\SNESROMS", slot);
|
||||
|
||||
/* Parse initial root directory and get entries list */
|
||||
if ((maxfiles = parseSDdirectory ()))
|
||||
{
|
||||
/* Select an entry */
|
||||
return FileSelector ();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no entries found */
|
||||
sprintf (msg, "SNESROMS not found on SDCARD (slot %s)", slot ? "B" : "A");
|
||||
WaitPrompt (msg);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* Retrieve previous entries list and made a new selection */
|
||||
else
|
||||
return FileSelector ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* LoadDVDFile
|
||||
*
|
||||
* This function will load a file from DVD, in BIN, SMD or ZIP format.
|
||||
* The values for offset and length are inherited from rootdir and
|
||||
* rootdirlength.
|
||||
*
|
||||
* The buffer parameter should re-use the initial ROM buffer.
|
||||
*/
|
||||
int
|
||||
LoadDVDFile (unsigned char *buffer)
|
||||
{
|
||||
int offset;
|
||||
int blocks;
|
||||
int i;
|
||||
u64 discoffset;
|
||||
char readbuffer[2048];
|
||||
|
||||
/*** SDCard Addition ***/
|
||||
if (rootdirlength == 0)
|
||||
return 0;
|
||||
|
||||
/*** How many 2k blocks to read ***/
|
||||
blocks = rootdirlength / 2048;
|
||||
offset = 0;
|
||||
discoffset = rootdir;
|
||||
ShowAction ("Loading ... Wait");
|
||||
dvd_read (readbuffer, 2048, discoffset);
|
||||
|
||||
if (!IsZipFile (readbuffer))
|
||||
|
||||
{
|
||||
for (i = 0; i < blocks; i++)
|
||||
|
||||
{
|
||||
dvd_read (readbuffer, 2048, discoffset);
|
||||
memcpy (buffer + offset, readbuffer, 2048);
|
||||
offset += 2048;
|
||||
discoffset += 2048;
|
||||
}
|
||||
|
||||
/*** And final cleanup ***/
|
||||
if (rootdirlength % 2048)
|
||||
|
||||
{
|
||||
i = rootdirlength % 2048;
|
||||
dvd_read (readbuffer, 2048, discoffset);
|
||||
memcpy (buffer + offset, readbuffer, i);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
return UnZipBuffer (buffer, discoffset, rootdirlength);
|
||||
}
|
||||
return rootdirlength;
|
||||
}
|
23
source/ngc/filesel.h
Normal file
23
source/ngc/filesel.h
Normal file
@ -0,0 +1,23 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Filesel - borrowed from GPP
|
||||
*
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _NGCFILESEL_
|
||||
#define _NGCFILESEL_
|
||||
|
||||
int OpenDVD ();
|
||||
int OpenSMB ();
|
||||
int OpenSD (int slot);
|
||||
|
||||
#define LOAD_DVD 1
|
||||
#define LOAD_SMB 2
|
||||
#define LOAD_SDC 4
|
||||
#define SNESROMDIR "SNESROMS"
|
||||
#define SNESSAVEDIR "SNESSAVE"
|
||||
|
||||
#endif
|
12
source/ngc/fontface.s
Normal file
12
source/ngc/fontface.s
Normal file
@ -0,0 +1,12 @@
|
||||
# Fonts
|
||||
|
||||
.rodata
|
||||
.globl fontface
|
||||
.balign 32
|
||||
fontface:
|
||||
.incbin "../source/ngc/ttf/font.ttf"
|
||||
|
||||
|
||||
.globl fontsize
|
||||
fontsize: .long 28736
|
||||
|
818
source/ngc/ftfont.cpp
Normal file
818
source/ngc/ftfont.cpp
Normal file
@ -0,0 +1,818 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Screen Font Driver
|
||||
*
|
||||
* Uses libfreetype 2.2.1 compiled for GC with TTF support only.
|
||||
* TTF only reduces the library by some 900k bytes!
|
||||
*
|
||||
* Visit - http://www.freetype.org !
|
||||
*
|
||||
* **WARNING***
|
||||
*
|
||||
* ONLY USE GUARANTEED PATENT FREE FONTS.
|
||||
* THOSE IN YOUR WINDOWS\FONTS DIRECTORY ARE COPYRIGHT
|
||||
* AND MAY NOT BE DISTRIBUTED!
|
||||
*
|
||||
* softdev July 2006
|
||||
* crunchy2 June 2007
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include "video.h"
|
||||
#include "ftfont.h"
|
||||
#include "dkpro.h"
|
||||
#include "tempgfx.h"
|
||||
|
||||
#include "aram.h"
|
||||
#include <zlib.h>
|
||||
|
||||
/*** Globals ***/
|
||||
FT_Library ftlibrary;
|
||||
FT_Face face;
|
||||
FT_GlyphSlot slot;
|
||||
FT_UInt glyph_index;
|
||||
static unsigned int fonthi, fontlo;
|
||||
|
||||
extern char fontface[]; /*** From fontface.s ***/
|
||||
extern int fontsize; /*** From fontface.s ***/
|
||||
extern int screenheight;
|
||||
extern unsigned int *xfb[2];
|
||||
extern int whichfb;
|
||||
|
||||
/**
|
||||
* Unpack the devkit pro logo
|
||||
*/
|
||||
static u32 *dkproraw;
|
||||
static u32 *backdrop; /*** Permanent backdrop ***/
|
||||
static void unpackbackdrop ();
|
||||
unsigned int getcolour (u8 r1, u8 g1, u8 b1);
|
||||
void DrawLineFast( int startx, int endx, int y, u8 r, u8 g, u8 b );
|
||||
u32 getrgb( u32 ycbr, u32 low );
|
||||
|
||||
/**
|
||||
* Initialisation of libfreetype
|
||||
*/
|
||||
int
|
||||
FT_Init ()
|
||||
{
|
||||
|
||||
int err;
|
||||
|
||||
err = FT_Init_FreeType (&ftlibrary);
|
||||
if (err)
|
||||
return 1;
|
||||
|
||||
err =
|
||||
FT_New_Memory_Face (ftlibrary, (FT_Byte *) fontface, fontsize, 0, &face);
|
||||
if (err)
|
||||
return 1;
|
||||
|
||||
setfontsize (16);
|
||||
|
||||
slot = face->glyph;
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* setfontsize
|
||||
*
|
||||
* Set the screen font size in pixels
|
||||
*/
|
||||
void
|
||||
setfontsize (int pixelsize)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = FT_Set_Pixel_Sizes (face, 0, pixelsize);
|
||||
|
||||
if (err)
|
||||
printf ("Error setting pixel sizes!");
|
||||
}
|
||||
|
||||
static void
|
||||
DrawCharacter (FT_Bitmap * bmp, FT_Int x, FT_Int y)
|
||||
{
|
||||
FT_Int i, j, p, q;
|
||||
FT_Int x_max = x + bmp->width;
|
||||
FT_Int y_max = y + bmp->rows;
|
||||
int spos;
|
||||
unsigned int pixel;
|
||||
int c;
|
||||
|
||||
for (i = x, p = 0; i < x_max; i++, p++)
|
||||
{
|
||||
for (j = y, q = 0; j < y_max; j++, q++)
|
||||
{
|
||||
if (i < 0 || j < 0 || i >= 640 || j >= screenheight)
|
||||
continue;
|
||||
|
||||
/*** Convert pixel position to GC int sizes ***/
|
||||
spos = (j * 320) + (i >> 1);
|
||||
|
||||
pixel = xfb[whichfb][spos];
|
||||
c = bmp->buffer[q * bmp->width + p];
|
||||
|
||||
/*** Cool Anti-Aliasing doesn't work too well at hires on GC ***/
|
||||
if (c > 128)
|
||||
{
|
||||
if (i & 1)
|
||||
pixel = (pixel & 0xffff0000) | fontlo;
|
||||
else
|
||||
pixel = ((pixel & 0xffff) | fonthi);
|
||||
|
||||
xfb[whichfb][spos] = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DrawText
|
||||
*
|
||||
* Place the font bitmap on the screen
|
||||
*/
|
||||
void
|
||||
DrawText (int x, int y, char *text)
|
||||
{
|
||||
int px, n;
|
||||
int i;
|
||||
int err;
|
||||
int value, count;
|
||||
|
||||
n = strlen (text);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
/*** x == -1, auto centre ***/
|
||||
if (x == -1)
|
||||
{
|
||||
value = 0;
|
||||
px = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = 1;
|
||||
px = x;
|
||||
}
|
||||
|
||||
for (count = value; count < 2; count++)
|
||||
{
|
||||
/*** Draw the string ***/
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
err = FT_Load_Char (face, text[i], FT_LOAD_RENDER);
|
||||
|
||||
if (err)
|
||||
{
|
||||
printf ("Error %c %d\n", text[i], err);
|
||||
continue; /*** Skip unprintable characters ***/
|
||||
}
|
||||
|
||||
if (count)
|
||||
DrawCharacter (&slot->bitmap, px + slot->bitmap_left,
|
||||
y - slot->bitmap_top);
|
||||
|
||||
px += slot->advance.x >> 6;
|
||||
}
|
||||
|
||||
px = (640 - px) >> 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setfontcolour
|
||||
*
|
||||
* Uses RGB triple values.
|
||||
*/
|
||||
void
|
||||
setfontcolour (u8 r, u8 g, u8 b)
|
||||
{
|
||||
u32 fontcolour;
|
||||
|
||||
fontcolour = getcolour (r, g, b);
|
||||
fonthi = fontcolour & 0xffff0000;
|
||||
fontlo = fontcolour & 0xffff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Licence Information
|
||||
*
|
||||
* THIS MUST NOT BE REMOVED IN ANY DERIVATIVE WORK.
|
||||
*/
|
||||
void
|
||||
licence ()
|
||||
{
|
||||
|
||||
int ypos = ((screenheight - (282 + dkpro_HEIGHT)) >> 1);
|
||||
|
||||
if (screenheight == 480)
|
||||
ypos += 42;
|
||||
else
|
||||
ypos += 24;
|
||||
|
||||
setfontcolour (0x00, 0x00, 0x00);
|
||||
|
||||
DrawText (-1, ypos += 40, "Snes9x - Copyright (c) Snes9x Team 1996 - 2006");
|
||||
|
||||
DrawText (-1, ypos += 40, "This is free software, and you are welcome to");
|
||||
DrawText (-1, ypos += 20, "redistribute it under the conditions of the");
|
||||
DrawText (-1, ypos += 20, "GNU GENERAL PUBLIC LICENSE Version 2");
|
||||
DrawText (-1, ypos +=
|
||||
20, "Additionally, the developers of this port disclaims");
|
||||
DrawText (-1, ypos +=
|
||||
20, "all copyright interests in the Nintendo GameCube");
|
||||
DrawText (-1, ypos +=
|
||||
20, "porting code. You are free to use it as you wish");
|
||||
|
||||
DrawText (-1, ypos += 40, "Developed with DevkitPPC and libOGC");
|
||||
DrawText (-1, ypos += 20, "http://www.devkitpro.org");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* dkunpack
|
||||
*
|
||||
* Support function to expand the DevkitPro logo
|
||||
*/
|
||||
int
|
||||
dkunpack ()
|
||||
{
|
||||
unsigned long res, inbytes, outbytes;
|
||||
|
||||
inbytes = dkpro_COMPRESSED;
|
||||
outbytes = dkpro_RAW;
|
||||
dkproraw = (u32 *) malloc (dkpro_RAW + 16);
|
||||
|
||||
res = uncompress ((Bytef *) dkproraw, &outbytes, (Bytef *) dkpro, inbytes);
|
||||
|
||||
if (res == Z_OK)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* showdklogo
|
||||
*
|
||||
* Display the DevkitPro logo
|
||||
*/
|
||||
void
|
||||
showdklogo ()
|
||||
{
|
||||
int w, h, p, dispoffset;
|
||||
p = 0;
|
||||
dispoffset =
|
||||
((screenheight != 480 ? 360 : 350) * 320) + ((640 - dkpro_WIDTH) >> 2);
|
||||
|
||||
dkunpack ();
|
||||
|
||||
for (h = 0; h < dkpro_HEIGHT; h++)
|
||||
{
|
||||
for (w = 0; w < dkpro_WIDTH >> 1; w++)
|
||||
{
|
||||
if (dkproraw[p] != 0x00800080)
|
||||
xfb[whichfb][dispoffset + w] = dkproraw[p++];
|
||||
else
|
||||
p++;
|
||||
}
|
||||
|
||||
dispoffset += 320;
|
||||
}
|
||||
|
||||
free (dkproraw);
|
||||
}
|
||||
|
||||
/**
|
||||
* getcolour
|
||||
*
|
||||
* Simply converts RGB to Y1CbY2Cr format
|
||||
*
|
||||
* I got this from a pastebin, so thanks to whoever originally wrote it!
|
||||
*/
|
||||
|
||||
unsigned int
|
||||
getcolour (u8 r1, u8 g1, u8 b1)
|
||||
{
|
||||
int y1, cb1, cr1, y2, cb2, cr2, cb, cr;
|
||||
u8 r2, g2, b2;
|
||||
|
||||
r2 = r1;
|
||||
g2 = g1;
|
||||
b2 = b1;
|
||||
|
||||
y1 = (299 * r1 + 587 * g1 + 114 * b1) / 1000;
|
||||
cb1 = (-16874 * r1 - 33126 * g1 + 50000 * b1 + 12800000) / 100000;
|
||||
cr1 = (50000 * r1 - 41869 * g1 - 8131 * b1 + 12800000) / 100000;
|
||||
|
||||
y2 = (299 * r2 + 587 * g2 + 114 * b2) / 1000;
|
||||
cb2 = (-16874 * r2 - 33126 * g2 + 50000 * b2 + 12800000) / 100000;
|
||||
cr2 = (50000 * r2 - 41869 * g2 - 8131 * b2 + 12800000) / 100000;
|
||||
|
||||
cb = (cb1 + cb2) >> 1;
|
||||
cr = (cr1 + cr2) >> 1;
|
||||
|
||||
return ((y1 << 24) | (cb << 16) | (y2 << 8) | cr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpackbackdrop
|
||||
*/
|
||||
void
|
||||
unpackbackdrop ()
|
||||
{
|
||||
unsigned long res, inbytes, outbytes;
|
||||
unsigned int colour;
|
||||
int offset;
|
||||
int i;
|
||||
|
||||
backdrop = (unsigned int *) malloc (screenheight * 1280);
|
||||
colour = getcolour (0x00, 0x00, 0x00);
|
||||
|
||||
/*** Fill with black for now ***/
|
||||
for (i = 0; i < (320 * screenheight); i++)
|
||||
backdrop[i] = colour;
|
||||
|
||||
/*** If it's PAL50, need to move down a few lines ***/
|
||||
offset = ((screenheight - 480) >> 1) * 320;
|
||||
inbytes = tempgfx_COMPRESSED;
|
||||
outbytes = tempgfx_RAW;
|
||||
|
||||
res =
|
||||
uncompress ((Bytef *) backdrop + offset, &outbytes, (Bytef *) tempgfx,
|
||||
inbytes);
|
||||
|
||||
/*** Now store the backdrop in ARAM ***/
|
||||
ARAMPut ((char *) backdrop, (char *) AR_BACKDROP, 640 * screenheight * 2);
|
||||
|
||||
free (backdrop);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display legal copyright and licence
|
||||
*/
|
||||
void
|
||||
legal ()
|
||||
{
|
||||
unpackbackdrop ();
|
||||
clearscreen ();
|
||||
licence ();
|
||||
showdklogo ();
|
||||
showscreen ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for user to press A
|
||||
*/
|
||||
void
|
||||
WaitButtonA ()
|
||||
{
|
||||
while (PAD_ButtonsDown (0) & PAD_BUTTON_A);
|
||||
while (!(PAD_ButtonsDown (0) & PAD_BUTTON_A));
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for user to press A or B. Returns 0 = B; 1 = A
|
||||
*/
|
||||
int
|
||||
WaitButtonAB ()
|
||||
{
|
||||
int btns;
|
||||
|
||||
while ( (PAD_ButtonsDown (0) & (PAD_BUTTON_A | PAD_BUTTON_B)) );
|
||||
|
||||
while ( TRUE )
|
||||
{
|
||||
btns = PAD_ButtonsDown (0);
|
||||
if ( btns & PAD_BUTTON_A )
|
||||
return 1;
|
||||
else if ( btns & PAD_BUTTON_B )
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a prompt
|
||||
*/
|
||||
void
|
||||
WaitPrompt (char *msg)
|
||||
{
|
||||
int ypos = (screenheight - 64) >> 1;
|
||||
|
||||
if (screenheight == 480)
|
||||
ypos += 52;
|
||||
else
|
||||
ypos += 32;
|
||||
|
||||
clearscreen ();
|
||||
DrawText (-1, ypos, msg);
|
||||
ypos += 30;
|
||||
DrawText (-1, ypos, "Press A to continue");
|
||||
showscreen ();
|
||||
WaitButtonA ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a prompt with choice of two options. Returns 1 if A button was pressed
|
||||
and 0 if B button was pressed.
|
||||
*/
|
||||
int
|
||||
WaitPromptChoice (char *msg, char *bmsg, char *amsg)
|
||||
{
|
||||
int ypos = (screenheight - 64) >> 1;
|
||||
|
||||
if (screenheight == 480)
|
||||
ypos += 37;
|
||||
else
|
||||
ypos += 17;
|
||||
|
||||
clearscreen ();
|
||||
DrawText (-1, ypos, msg);
|
||||
ypos += 60;
|
||||
char txt[80];
|
||||
sprintf (txt, "B = %s : A = %s", bmsg, amsg);
|
||||
DrawText (-1, ypos, txt);
|
||||
showscreen ();
|
||||
return WaitButtonAB ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an action in progress
|
||||
*/
|
||||
void
|
||||
ShowAction (char *msg)
|
||||
{
|
||||
int ypos = (screenheight - 30) >> 1;
|
||||
|
||||
if (screenheight == 480)
|
||||
ypos += 52;
|
||||
else
|
||||
ypos += 32;
|
||||
|
||||
clearscreen ();
|
||||
DrawText (-1, ypos, msg);
|
||||
showscreen ();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Generic Menu Routines
|
||||
****************************************************************************/
|
||||
void
|
||||
DrawMenu (char items[][20], char *title, int maxitems, int selected)
|
||||
{
|
||||
int i, w;
|
||||
int ypos;
|
||||
|
||||
#if 0
|
||||
int bounding[] = { 80, 40, 600, 40, 560, 94, 40, 94 };
|
||||
int base[] = { 80, screenheight - 90, 600, screenheight - 90,
|
||||
560, screenheight - 40, 40, screenheight - 40
|
||||
};
|
||||
#endif
|
||||
|
||||
ypos = (screenheight - (maxitems * 32)) >> 1;
|
||||
|
||||
if (screenheight == 480)
|
||||
ypos += 52;
|
||||
else
|
||||
ypos += 32;
|
||||
|
||||
clearscreen ();
|
||||
|
||||
#if 0
|
||||
DrawPolygon (4, bounding, 0x00, 0x00, 0xc0);
|
||||
DrawPolygon (4, base, 0x00, 0x00, 0xc0);
|
||||
setfontsize (32);
|
||||
DrawText (-1, 80, title);
|
||||
DrawText (-1, screenheight - 50, "Snes9x - GX 2.0");
|
||||
#endif
|
||||
|
||||
setfontsize (24);
|
||||
setfontcolour (0, 0, 0);
|
||||
|
||||
for (i = 0; i < maxitems; i++)
|
||||
{
|
||||
if (i == selected)
|
||||
{
|
||||
for( w = 0; w < 32; w++ )
|
||||
DrawLineFast( 30, 610, (i << 5) + (ypos-26) + w, 0x80, 0x80, 0x80 );
|
||||
|
||||
setfontcolour (0xff, 0xff, 0xff);
|
||||
DrawText (-1, (i << 5) + ypos, items[i]);
|
||||
setfontcolour (0x00, 0x00, 0x00);
|
||||
}
|
||||
else
|
||||
DrawText (-1, i * 32 + ypos, items[i]);
|
||||
}
|
||||
|
||||
showscreen ();
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* RunMenu
|
||||
*
|
||||
* Call this with the menu array defined in menu.cpp
|
||||
* It's here to keep all the font / interface stuff together.
|
||||
****************************************************************************/
|
||||
int menu = 0;
|
||||
int
|
||||
RunMenu (char items[][20], int maxitems, char *title)
|
||||
{
|
||||
int redraw = 1;
|
||||
int quit = 0;
|
||||
short p;
|
||||
int ret = 0;
|
||||
signed char a;
|
||||
|
||||
//while (!(PAD_ButtonsDown (0) & PAD_BUTTON_B) && (quit == 0))
|
||||
while (quit == 0)
|
||||
{
|
||||
if (redraw)
|
||||
{
|
||||
DrawMenu (&items[0], title, maxitems, menu);
|
||||
redraw = 0;
|
||||
}
|
||||
|
||||
p = PAD_ButtonsDown (0);
|
||||
a = PAD_StickY (0);
|
||||
|
||||
/*** Look for up ***/
|
||||
if ((p & PAD_BUTTON_UP) || (a > 70))
|
||||
{
|
||||
redraw = 1;
|
||||
menu--;
|
||||
}
|
||||
|
||||
/*** Look for down ***/
|
||||
if ((p & PAD_BUTTON_DOWN) || (a < -70))
|
||||
{
|
||||
redraw = 1;
|
||||
menu++;
|
||||
}
|
||||
|
||||
if (p & PAD_BUTTON_A)
|
||||
{
|
||||
quit = 1;
|
||||
ret = menu;
|
||||
}
|
||||
|
||||
if (p & PAD_BUTTON_B)
|
||||
{
|
||||
quit = -1;
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (menu == maxitems)
|
||||
menu = 0;
|
||||
|
||||
if (menu < 0)
|
||||
menu = maxitems - 1;
|
||||
}
|
||||
|
||||
if (PAD_ButtonsDown (0) & PAD_BUTTON_B)
|
||||
{
|
||||
/*** Wait for B button to be released before proceeding ***/
|
||||
while (PAD_ButtonsDown (0) & PAD_BUTTON_B)
|
||||
VIDEO_WaitVSync();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* DrawLine
|
||||
*
|
||||
* Quick'n'Dirty Bresenham line drawing routine.
|
||||
****************************************************************************/
|
||||
#define SIGN(x) ((x<0)?-1:((x>0)?1:0))
|
||||
|
||||
void
|
||||
DrawLine (int x1, int y1, int x2, int y2, u8 r, u8 g, u8 b)
|
||||
{
|
||||
u32 colour, pixel;
|
||||
u32 colourhi, colourlo;
|
||||
int i, dx, dy, sdx, sdy, dxabs, dyabs, x, y, px, py;
|
||||
int sp;
|
||||
|
||||
colour = getcolour (r, g, b);
|
||||
colourhi = colour & 0xffff0000;
|
||||
colourlo = colour & 0xffff;
|
||||
|
||||
dx = x2 - x1; /*** Horizontal distance ***/
|
||||
dy = y2 - y1; /*** Vertical distance ***/
|
||||
|
||||
dxabs = abs (dx);
|
||||
dyabs = abs (dy);
|
||||
sdx = SIGN (dx);
|
||||
sdy = SIGN (dy);
|
||||
x = dyabs >> 1;
|
||||
y = dxabs >> 1;
|
||||
px = x1;
|
||||
py = y1;
|
||||
|
||||
sp = (py * 320) + (px >> 1);
|
||||
pixel = xfb[whichfb][sp];
|
||||
/*** Plot this pixel ***/
|
||||
if (px & 1)
|
||||
xfb[whichfb][sp] = (pixel & 0xffff0000) | colourlo;
|
||||
else
|
||||
xfb[whichfb][sp] = (pixel & 0xffff) | colourhi;
|
||||
|
||||
if (dxabs >= dyabs) /*** Mostly horizontal ***/
|
||||
{
|
||||
for (i = 0; i < dxabs; i++)
|
||||
{
|
||||
y += dyabs;
|
||||
if (y >= dxabs)
|
||||
{
|
||||
y -= dxabs;
|
||||
py += sdy;
|
||||
}
|
||||
|
||||
px += sdx;
|
||||
|
||||
sp = (py * 320) + (px >> 1);
|
||||
pixel = xfb[whichfb][sp];
|
||||
|
||||
if (px & 1)
|
||||
xfb[whichfb][sp] = (pixel & 0xffff0000) | colourlo;
|
||||
else
|
||||
xfb[whichfb][sp] = (pixel & 0xffff) | colourhi;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < dyabs; i++)
|
||||
{
|
||||
x += dxabs;
|
||||
if (x >= dyabs)
|
||||
{
|
||||
x -= dyabs;
|
||||
px += sdx;
|
||||
}
|
||||
|
||||
py += sdy;
|
||||
|
||||
sp = (py * 320) + (px >> 1);
|
||||
pixel = xfb[whichfb][sp];
|
||||
|
||||
if (px & 1)
|
||||
xfb[whichfb][sp] = (pixel & 0xffff0000) | colourlo;
|
||||
else
|
||||
xfb[whichfb][sp] = (pixel & 0xffff) | colourhi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Progress Bar
|
||||
*
|
||||
* Show the user what's happening
|
||||
****************************************************************************/
|
||||
void
|
||||
ShowProgress (char *msg, int done, int total)
|
||||
{
|
||||
int ypos = (screenheight - 30) >> 1;
|
||||
|
||||
if (screenheight == 480)
|
||||
ypos += 52;
|
||||
else
|
||||
ypos += 32;
|
||||
|
||||
int xpos;
|
||||
int i;
|
||||
|
||||
clearscreen ();
|
||||
DrawText (-1, ypos, msg);
|
||||
|
||||
/*** Draw a white outline box ***/
|
||||
for (i = 380; i < 401; i++)
|
||||
DrawLine (100, i, 540, i, 0xff, 0xff, 0xff);
|
||||
|
||||
/*** Show progess ***/
|
||||
xpos = (int) (((float) done / (float) total) * 438);
|
||||
|
||||
for (i = 381; i < 400; i++)
|
||||
DrawLine (101, i, 101 + xpos, i, 0x00, 0x00, 0x80);
|
||||
|
||||
showscreen ();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* DrawPolygon
|
||||
****************************************************************************/
|
||||
void
|
||||
DrawPolygon (int vertices, int varray[], u8 r, u8 g, u8 b)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < vertices - 1; i++)
|
||||
{
|
||||
DrawLine (varray[(i << 1)], varray[(i << 1) + 1], varray[(i << 1) + 2],
|
||||
varray[(i << 1) + 3], r, g, b);
|
||||
}
|
||||
|
||||
DrawLine (varray[0], varray[1], varray[(vertices << 1) - 2],
|
||||
varray[(vertices << 1) - 1], r, g, b);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Draw Line Fast
|
||||
*
|
||||
* This routine requires that start and endx are 32bit aligned.
|
||||
* It tries to perform a semi-transparency over the existing image.
|
||||
*****************************************************************************/
|
||||
|
||||
#define SRCWEIGHT 0.7f
|
||||
#define DSTWEIGHT (1.0f - SRCWEIGHT)
|
||||
|
||||
static inline u8 c_adjust( u8 c , float weight )
|
||||
{
|
||||
return (u8)((float)c * weight);
|
||||
}
|
||||
|
||||
void DrawLineFast( int startx, int endx, int y, u8 r, u8 g, u8 b )
|
||||
{
|
||||
int width;
|
||||
u32 offset;
|
||||
int i;
|
||||
u32 colour, clo, chi;
|
||||
u32 lo,hi;
|
||||
u8 *s, *d;
|
||||
|
||||
//colour = getcolour(r, g, b);
|
||||
colour = ( r << 16 | g << 8 | b );
|
||||
d = (u8 *)&colour;
|
||||
d[1] = c_adjust(d[1], DSTWEIGHT);
|
||||
d[2] = c_adjust(d[2], DSTWEIGHT);
|
||||
d[3] = c_adjust(d[3], DSTWEIGHT);
|
||||
|
||||
width = ( endx - startx ) >> 1;
|
||||
offset = ( y << 8 ) + ( y << 6 ) + ( startx >> 1 );
|
||||
|
||||
for ( i = 0; i < width; i++ )
|
||||
{
|
||||
lo = getrgb(xfb[whichfb][offset], 0);
|
||||
hi = getrgb(xfb[whichfb][offset], 1);
|
||||
|
||||
s = (u8 *)&hi;
|
||||
s[1] = ( ( c_adjust(s[1],SRCWEIGHT) ) + d[1] );
|
||||
s[2] = ( ( c_adjust(s[2],SRCWEIGHT) ) + d[2] );
|
||||
s[3] = ( ( c_adjust(s[3],SRCWEIGHT) ) + d[3] );
|
||||
|
||||
s = (u8 *)&lo;
|
||||
s[1] = ( ( c_adjust(s[1],SRCWEIGHT) ) + d[1] );
|
||||
s[2] = ( ( c_adjust(s[2],SRCWEIGHT) ) + d[2] );
|
||||
s[3] = ( ( c_adjust(s[3],SRCWEIGHT) ) + d[3] );
|
||||
|
||||
clo = getcolour( s[1], s[2], s[3] );
|
||||
s = (u8 *)&hi;
|
||||
chi = getcolour( s[1], s[2], s[3] );
|
||||
|
||||
xfb[whichfb][offset++] = (chi & 0xffff0000 ) | ( clo & 0xffff) ;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ok, I'm useless with Y1CBY2CR colour.
|
||||
* So convert back to RGB so I can work with it -;)
|
||||
*/
|
||||
u32 getrgb( u32 ycbr, u32 low )
|
||||
{
|
||||
u8 r,g,b;
|
||||
u32 y;
|
||||
s8 cb,cr;
|
||||
|
||||
if ( low )
|
||||
y = ( ycbr & 0xff00 ) >> 8;
|
||||
else
|
||||
y = ( ycbr & 0xff000000 ) >> 24;
|
||||
|
||||
cr = ycbr & 0xff;
|
||||
cb = ( ycbr & 0xff0000 ) >> 16;
|
||||
|
||||
cr -= 128;
|
||||
cb -= 128;
|
||||
|
||||
r = (u8)((float)y + 1.371 * (float)cr);
|
||||
g = (u8)((float)y - 0.698 * (float)cr - 0.336 * (float)cb);
|
||||
b = (u8)((float)y + 1.732 * (float)cb);
|
||||
|
||||
return (u32)( r << 16 | g << 8 | b );
|
||||
|
||||
}
|
||||
|
||||
|
38
source/ngc/ftfont.h
Normal file
38
source/ngc/ftfont.h
Normal file
@ -0,0 +1,38 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Screen Font Driver
|
||||
*
|
||||
* Uses libfreetype 2.2.1 compiled for GC with TTF support only.
|
||||
* TTF only reduces the library by some 900kbytes!
|
||||
*
|
||||
* Visit - http://www.freetype.org !
|
||||
*
|
||||
* **WARNING***
|
||||
*
|
||||
* ONLY USE GUARANTEED PATENT FREE FONTS.
|
||||
* THOSE IN YOUR WINDOWS\FONTS DIRECTORY ARE COPYRIGHT
|
||||
* AND MAY NOT BE DISTRIBUTED!
|
||||
*
|
||||
* softdev July 2006
|
||||
* crunchy2 June 2007
|
||||
****************************************************************************/
|
||||
#ifndef _TTFFONTS_
|
||||
#define _TTFFONTS_
|
||||
|
||||
int FT_Init ();
|
||||
void setfontsize (int pixelsize);
|
||||
void DrawText (int x, int y, char *text);
|
||||
void legal ();
|
||||
void highlight (int on);
|
||||
void WaitButtonA ();
|
||||
void setfontcolour (u8 r, u8 g, u8 b);
|
||||
int RunMenu (char items[][20], int maxitems, char *title);
|
||||
void WaitPrompt (char *msg);
|
||||
int WaitPromptChoice (char *msg, char* bmsg, char* amsg);
|
||||
void ShowAction (char *msg);
|
||||
void ShowProgress (char *msg, int done, int total);
|
||||
void DrawPolygon (int vertices, int *varray, u8 r, u8 g, u8 b);
|
||||
void DrawLineFast( int startx, int endx, int y, u8 r, u8 g, u8 b );
|
||||
|
||||
#endif
|
281
source/ngc/gcglobals.cpp
Normal file
281
source/ngc/gcglobals.cpp
Normal file
@ -0,0 +1,281 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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 "snes9xGx.h"
|
||||
START_EXTERN_C
|
||||
struct SGCSettings GCSettings;
|
||||
bool8 isWii;
|
||||
|
||||
unsigned short saveicon[1024] = {
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xE73F,
|
||||
0xFFFF, 0xFFFF, 0xB5BF, 0x801F, 0xFFFF, 0xD29F, 0x801F, 0x801F,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xA11E, 0x843C, 0x8439, 0x9CF7,
|
||||
0x801F, 0x801F, 0x801C, 0x8018, 0x801F, 0x801F, 0x801C, 0x8018,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xEB5C, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0x800F, 0xB9D3, 0xFFFF, 0xFFFF, 0x8013, 0x8008, 0xDAD7, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0x801F, 0x801F, 0x885F, 0xFFFF, 0x98D6, 0x801F, 0x801F,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0x843C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFBDF, 0x801E, 0x801B, 0x8017, 0x801E, 0x801B, 0x8018, 0x8015,
|
||||
0x801A, 0x8018, 0x8015, 0x8011, 0x8016, 0x8014, 0x8011, 0x800D,
|
||||
0x8012, 0x800B, 0x8848, 0xFFFF, 0x8010, 0x8009, 0x8003, 0xFFFF,
|
||||
0x800C, 0x8007, 0x8006, 0xFFFF, 0x8008, 0x8005, 0xA52E, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFBBD, 0xF1EF, 0xFFFF, 0xF508, 0xF000, 0xEC00,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xE56B, 0xE16B, 0xE673, 0xFFFF, 0xE800, 0xDC00, 0xCC00, 0xB400,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xDE94, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xEBBA,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xEFBA, 0xE378, 0xB2EB, 0x9AA4, 0x9AA5, 0x9AA5,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xE778, 0xF3BC, 0xFFFF, 0xFFFF, 0x9A84, 0x9623, 0x91E3, 0xB66C,
|
||||
0xD6BB, 0x800E, 0x800C, 0x8008, 0xFFFF, 0x8C6A, 0x8004, 0x8004,
|
||||
0xFFFF, 0xFFFF, 0xB191, 0xDAD8, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0x8006, 0x8004, 0xFFFF, 0xFFFF, 0x8006, 0xF39D, 0xFFFF, 0xFA94,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xEC21, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xF484, 0xF800, 0xF800, 0xF000, 0xF800, 0xF800, 0xFD6B, 0xF8C6,
|
||||
0xF400, 0xF400, 0xFDEF, 0xF4A5, 0xFF18, 0xEC63, 0xE400, 0xE000,
|
||||
0xE800, 0xE000, 0xD400, 0xC400, 0xE400, 0xE000, 0xD000, 0xC400,
|
||||
0xE000, 0xD800, 0xCC00, 0xC000, 0xD800, 0xD000, 0xC400, 0xB800,
|
||||
0xA400, 0xD673, 0xFFFF, 0xFFFF, 0xB400, 0x9000, 0xFFFF, 0xFFFF,
|
||||
0xB000, 0x9000, 0xFFFF, 0xFFFF, 0xA800, 0x9000, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xDB75, 0x9AE4, 0xFFFF, 0xFFFF, 0x9A84, 0xA6E7,
|
||||
0xFFFF, 0xFFFF, 0xA1E7, 0x9604, 0xFFFF, 0xFFFF, 0xFFFF, 0x8D03,
|
||||
0xA707, 0xA708, 0xAF2A, 0xAF2A, 0xA6E7, 0xA2C7, 0xBF4E, 0xCB71,
|
||||
0x9E46, 0x9E26, 0x9A25, 0x9604, 0x80E0, 0x8922, 0x8D22, 0x8D22,
|
||||
0xA2C7, 0xA2A7, 0x9E66, 0x95E4, 0xA2A6, 0x9E46, 0x9E25, 0x95C4,
|
||||
0x99E5, 0x95C4, 0x9163, 0x8D02, 0x88E2, 0x84A1, 0x8060, 0x8020,
|
||||
0x8500, 0xF7BD, 0xFFFF, 0xFFFF, 0x8901, 0xA148, 0xFFFF, 0xFFFF,
|
||||
0x8040, 0xB9ED, 0xFFFF, 0xFFFF, 0x9926, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xE529, 0xD400, 0xFFFF, 0xFFFF, 0xFFFF, 0xD4C6,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xD000, 0xC400, 0xBC00, 0xB000, 0xC000, 0xB800, 0xAC00, 0xA000,
|
||||
0xA800, 0xA800, 0x9C00, 0x9400, 0xC18C, 0x8C00, 0x8C00, 0x8C00,
|
||||
0x9C00, 0x8C00, 0xFFFF, 0xFFFF, 0x9400, 0x8C00, 0xFFFF, 0xFFFF,
|
||||
0x8800, 0xDEB5, 0xFFFF, 0xFFFF, 0xE2D6, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xD6D5, 0xAD8A, 0x8CC3, 0x8060, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0x8060, 0x90E4, 0xB1CC, 0xE759, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFE, 0xFFFF, 0xFFFF, 0xFFFF, 0xF7AF,
|
||||
0xFFFF, 0xFFFF, 0xFBDC, 0xF7B1, 0xFFFB, 0xFFE2, 0xFFE0, 0xFFE0,
|
||||
0xFFE0, 0xFFE0, 0xFFE0, 0xFFE0, 0xFFE0, 0xFFE0, 0xFFE0, 0xFFE5,
|
||||
0xF38C, 0xEF6A, 0xEB4B, 0xEB4F, 0xFFE0, 0xFBC0, 0xF7A0, 0xEB40,
|
||||
0xFFE0, 0xFFE0, 0xFBC0, 0xF7A0, 0xFFF5, 0xFFE4, 0xF380, 0xEF60,
|
||||
0xEF76, 0xFFFF, 0xFFFF, 0xFFFF, 0xE300, 0xCE60, 0xD6AB, 0xFFFF,
|
||||
0xEB40, 0xE300, 0xCE60, 0xB180, 0xE720, 0xDEE0, 0xCE60, 0xB180,
|
||||
0xF7BD, 0xB96B, 0xDAB4, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xB9CA, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xF399, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xD280, 0xEB40, 0xEB40, 0xEB40, 0xDAD1, 0xAD60, 0xC200, 0xCA40,
|
||||
0xFFFF, 0xF7BE, 0xBDEB, 0x98C0, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xEB40, 0xE720, 0xE300, 0xDAC0, 0xCA40, 0xC620, 0xC200, 0xBDE0,
|
||||
0x9080, 0x94A0, 0x94A0, 0x9080, 0xFBDD, 0xE738, 0xE337, 0xE738,
|
||||
0xD280, 0xCA40, 0xB5A0, 0x98C0, 0xB180, 0xA100, 0x94A0, 0x9080,
|
||||
0x8C60, 0x9080, 0xC20C, 0xFFFF, 0xF7BD, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xB9C9, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFE, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
};
|
||||
|
||||
END_EXTERN_C
|
||||
|
51
source/ngc/gctime.cpp
Normal file
51
source/ngc/gctime.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
/****************************************************************************
|
||||
* gctime.cpp
|
||||
****************************************************************************/
|
||||
#include "gctime.h"
|
||||
|
||||
#define TB_CLOCK 40500000
|
||||
|
||||
|
||||
unsigned long tb_diff_msec(tb_t *end, tb_t *start)
|
||||
{
|
||||
unsigned long upper, lower;
|
||||
upper = end->u - start->u;
|
||||
if (start->l > end->l)
|
||||
upper--;
|
||||
lower = end->l - start->l;
|
||||
return ((upper*((unsigned long)0x80000000/(TB_CLOCK/2000))) + (lower/(TB_CLOCK/1000)));
|
||||
}
|
||||
|
||||
unsigned long tb_diff_usec(tb_t *end, tb_t *start)
|
||||
{
|
||||
unsigned long upper, lower;
|
||||
upper = end->u - start->u;
|
||||
if (start->l > end->l)
|
||||
upper--;
|
||||
lower = end->l - start->l;
|
||||
return ((upper*((unsigned long)0x80000000/(TB_CLOCK/2000000))) + (lower/(TB_CLOCK/1000000)));
|
||||
}
|
||||
|
||||
void udelay(unsigned int us)
|
||||
{
|
||||
tb_t start, end;
|
||||
mftb(&start);
|
||||
while (1)
|
||||
{
|
||||
mftb(&end);
|
||||
if (tb_diff_usec(&end, &start) >= us)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void mdelay(unsigned int ms)
|
||||
{
|
||||
tb_t start, end;
|
||||
mftb(&start);
|
||||
while (1)
|
||||
{
|
||||
mftb(&end);
|
||||
if (tb_diff_msec(&end, &start) >= ms)
|
||||
break;
|
||||
}
|
||||
}
|
21
source/ngc/gctime.h
Normal file
21
source/ngc/gctime.h
Normal file
@ -0,0 +1,21 @@
|
||||
/****************************************************************************
|
||||
* gctime.h
|
||||
****************************************************************************/
|
||||
|
||||
#define mftb(rval) ({unsigned long u; do { \
|
||||
asm volatile ("mftbu %0" : "=r" (u)); \
|
||||
asm volatile ("mftb %0" : "=r" ((rval)->l)); \
|
||||
asm volatile ("mftbu %0" : "=r" ((rval)->u)); \
|
||||
} while(u != ((rval)->u)); })
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long l, u;
|
||||
} tb_t;
|
||||
|
||||
unsigned long tb_diff_msec(tb_t *end, tb_t *start);
|
||||
unsigned long tb_diff_usec(tb_t *end, tb_t *start);
|
||||
void udelay(unsigned int us);
|
||||
void mdelay(unsigned int ms);
|
||||
|
||||
|
565
source/ngc/mcsave.cpp
Normal file
565
source/ngc/mcsave.cpp
Normal file
@ -0,0 +1,565 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
* crunchy2 May-June 2007
|
||||
*
|
||||
* mcsave.cpp
|
||||
*
|
||||
* Memory Card Save Routines.
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "debug.h"
|
||||
#include "cpuexec.h"
|
||||
#include "ppu.h"
|
||||
#include "apu.h"
|
||||
#include "display.h"
|
||||
#include "gfx.h"
|
||||
#include "soundux.h"
|
||||
#include "spc700.h"
|
||||
#include "spc7110.h"
|
||||
|
||||
#include "snes9xGX.h"
|
||||
#include "video.h"
|
||||
#include "ftfont.h"
|
||||
#include "s9xconfig.h"
|
||||
#include "audio.h"
|
||||
#include "menu.h"
|
||||
#include "sram.h"
|
||||
#include "preferences.h"
|
||||
#include "mcsave.h"
|
||||
|
||||
#define VERIFBUFFERSIZE 65536
|
||||
static u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
||||
unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN (32);
|
||||
unsigned char verifbuffer[VERIFBUFFERSIZE] ATTRIBUTE_ALIGN (32);
|
||||
card_dir CardDir;
|
||||
card_file CardFile;
|
||||
card_stat CardStatus;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Clear the savebuffer
|
||||
****************************************************************************/
|
||||
void
|
||||
ClearSaveBuffer ()
|
||||
{
|
||||
memset (savebuffer, 0, SAVEBUFFERSIZE);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* CardFileExists
|
||||
*
|
||||
* Wrapper to search through the files on the card.
|
||||
* Returns TRUE if found.
|
||||
****************************************************************************/
|
||||
int
|
||||
CardFileExists (char *filename, int slot)
|
||||
{
|
||||
int CardError;
|
||||
|
||||
CardError = CARD_FindFirst (slot, &CardDir, TRUE);
|
||||
while (CardError != CARD_ERROR_NOFILE)
|
||||
{
|
||||
CardError = CARD_FindNext (&CardDir);
|
||||
|
||||
if (strcmp ((char *) CardDir.filename, filename) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* MountCard
|
||||
*
|
||||
* Mounts the memory card in the given slot. Error checking is done and
|
||||
* workarounds implemented for when the mount fails.
|
||||
* Returns the result of the last attempted CARD_Mount command.
|
||||
****************************************************************************/
|
||||
int MountCard(int cslot)
|
||||
{
|
||||
int ret;
|
||||
int tries;
|
||||
|
||||
EXI_ProbeReset();
|
||||
|
||||
/*** Mount the card ***/
|
||||
ret = CARD_Mount (cslot, SysArea, NULL);
|
||||
|
||||
tries = 0;
|
||||
while ( tries < 3 && ret == CARD_ERROR_IOERROR )
|
||||
{
|
||||
if (cslot == CARD_SLOTA)
|
||||
WaitPrompt("Replug card in slot A!");
|
||||
else
|
||||
WaitPrompt("Replug card in slot B!");
|
||||
|
||||
ShowAction("");
|
||||
ret = CARD_Mount (cslot, SysArea, NULL);
|
||||
tries++;
|
||||
}
|
||||
|
||||
tries = 0;
|
||||
while ( tries < 5 && ret == CARD_ERROR_NOCARD )
|
||||
{
|
||||
ShowAction("Mounting card...");
|
||||
CARD_Unmount (cslot);
|
||||
usleep(500000); // wait half second
|
||||
ShowAction("");
|
||||
usleep(500000); // wait half second
|
||||
ret = CARD_Mount (cslot, SysArea, NULL);
|
||||
tries++;
|
||||
}
|
||||
|
||||
tries = 0;
|
||||
while ( tries < 5 && ret == CARD_ERROR_UNLOCKED )
|
||||
{
|
||||
ShowAction("Waiting for unlock...");
|
||||
usleep(500000); // wait half second
|
||||
ShowAction("");
|
||||
usleep(500000); // wait half second
|
||||
ret = CARD_Probe(cslot);
|
||||
tries++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Verify Memory Card file against buffer
|
||||
****************************************************************************/
|
||||
int
|
||||
VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize)
|
||||
{
|
||||
int CardError;
|
||||
unsigned int blocks;
|
||||
unsigned int SectorSize;
|
||||
char msg[80];
|
||||
int bytesleft = 0;
|
||||
int bytesread = 0;
|
||||
|
||||
/*** Initialize Card System ***/
|
||||
memset (SysArea, 0, CARD_WORKAREA);
|
||||
CARD_Init ("SNES", "00");
|
||||
|
||||
/*** Try to mount the card ***/
|
||||
CardError = MountCard(slot);
|
||||
|
||||
if (CardError == 0)
|
||||
{
|
||||
/*** Get Sector Size ***/
|
||||
CARD_GetSectorSize (slot, &SectorSize);
|
||||
|
||||
if (!CardFileExists (filename, slot))
|
||||
{
|
||||
CARD_Unmount (slot);
|
||||
WaitPrompt ("Unable to open file for verify!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset (&CardFile, 0, sizeof (CardFile));
|
||||
CardError = CARD_Open (slot, filename, &CardFile);
|
||||
|
||||
blocks = CardFile.len;
|
||||
|
||||
if (blocks < SectorSize)
|
||||
blocks = SectorSize;
|
||||
|
||||
if (blocks % SectorSize)
|
||||
blocks += SectorSize;
|
||||
|
||||
if (blocks > (unsigned int)datasize)
|
||||
blocks = datasize;
|
||||
|
||||
memset (verifbuffer, 0, VERIFBUFFERSIZE);
|
||||
bytesleft = blocks;
|
||||
bytesread = 0;
|
||||
while (bytesleft > 0)
|
||||
{
|
||||
CARD_Read (&CardFile, verifbuffer, SectorSize, bytesread);
|
||||
if ( memcmp (buf + bytesread, verifbuffer, (unsigned int)bytesleft < SectorSize ? bytesleft : SectorSize) )
|
||||
{
|
||||
CARD_Close (&CardFile);
|
||||
CARD_Unmount (slot);
|
||||
WaitPrompt ("File did not verify!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bytesleft -= SectorSize;
|
||||
bytesread += SectorSize;
|
||||
|
||||
sprintf (msg, "Verified %d of %d bytes", bytesread, blocks);
|
||||
ShowProgress (msg, bytesread, blocks);
|
||||
}
|
||||
CARD_Close (&CardFile);
|
||||
CARD_Unmount (slot);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
if (slot == CARD_SLOTA)
|
||||
WaitPrompt ("Unable to Mount Slot A Memory Card!");
|
||||
else
|
||||
WaitPrompt ("Unable to Mount Slot B Memory Card!");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Load savebuffer from Memory Card file
|
||||
****************************************************************************/
|
||||
int
|
||||
LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent)
|
||||
{
|
||||
int CardError;
|
||||
unsigned int blocks;
|
||||
unsigned int SectorSize;
|
||||
char msg[80];
|
||||
int bytesleft = 0;
|
||||
int bytesread = 0;
|
||||
|
||||
/*** Initialize Card System ***/
|
||||
memset (SysArea, 0, CARD_WORKAREA);
|
||||
CARD_Init ("SNES", "00");
|
||||
|
||||
/*** Try to mount the card ***/
|
||||
CardError = MountCard(slot);
|
||||
|
||||
if (CardError == 0)
|
||||
{
|
||||
/*** Get Sector Size ***/
|
||||
CARD_GetSectorSize (slot, &SectorSize);
|
||||
|
||||
if (!CardFileExists (filename, slot))
|
||||
{
|
||||
if ( !silent )
|
||||
WaitPrompt ("Unable to open file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset (&CardFile, 0, sizeof (CardFile));
|
||||
CardError = CARD_Open (slot, filename, &CardFile);
|
||||
|
||||
blocks = CardFile.len;
|
||||
|
||||
if (blocks < SectorSize)
|
||||
blocks = SectorSize;
|
||||
|
||||
if (blocks % SectorSize)
|
||||
blocks += SectorSize;
|
||||
|
||||
memset (buf, 0, 0x22000);
|
||||
|
||||
bytesleft = blocks;
|
||||
bytesread = 0;
|
||||
while (bytesleft > 0)
|
||||
{
|
||||
CARD_Read (&CardFile, buf + bytesread, SectorSize, bytesread);
|
||||
bytesleft -= SectorSize;
|
||||
bytesread += SectorSize;
|
||||
|
||||
sprintf (msg, "Read %d of %d bytes", bytesread, blocks);
|
||||
ShowProgress (msg, bytesread, blocks);
|
||||
}
|
||||
CARD_Close (&CardFile);
|
||||
CARD_Unmount (slot);
|
||||
}
|
||||
else
|
||||
if (slot == CARD_SLOTA)
|
||||
WaitPrompt ("Unable to Mount Slot A Memory Card!");
|
||||
else
|
||||
WaitPrompt ("Unable to Mount Slot B Memory Card!");
|
||||
|
||||
return bytesread;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Write savebuffer to Memory Card file
|
||||
****************************************************************************/
|
||||
int
|
||||
SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool8 silent)
|
||||
{
|
||||
int CardError;
|
||||
unsigned int blocks;
|
||||
unsigned int SectorSize;
|
||||
char msg[80];
|
||||
|
||||
/*** Initialize Card System ***/
|
||||
memset (SysArea, 0, CARD_WORKAREA);
|
||||
CARD_Init ("SNES", "00");
|
||||
|
||||
/*** Try to mount the card ***/
|
||||
CardError = MountCard(slot);
|
||||
|
||||
if (CardError == 0)
|
||||
{
|
||||
/*** Get Sector Size ***/
|
||||
CARD_GetSectorSize (slot, &SectorSize);
|
||||
|
||||
if (datasize)
|
||||
{
|
||||
/*** Calculate number of blocks required ***/
|
||||
blocks = (datasize / SectorSize) * SectorSize;
|
||||
if (datasize % SectorSize)
|
||||
blocks += SectorSize;
|
||||
|
||||
/*** Does this file exist ? ***/
|
||||
if (CardFileExists (filename, slot))
|
||||
{
|
||||
/*** Try to open the file ***/
|
||||
CardError = CARD_Open (slot, filename, &CardFile);
|
||||
if (CardError)
|
||||
{
|
||||
CARD_Unmount (slot);
|
||||
WaitPrompt ("Unable to open card file!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if ( (s32)blocks < CardFile.len ) /*** new data is shorter ***/
|
||||
// {
|
||||
// CARD_Close (&CardFile);
|
||||
//
|
||||
// /*** Delete the existing longer file ***/
|
||||
// CardError = CARD_Delete(slot, filename);
|
||||
// if (CardError)
|
||||
// {
|
||||
// CARD_Unmount (slot);
|
||||
// WaitPrompt ("Unable to delete existing file!");
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// /*** Create new, shorter file ***/
|
||||
// CardError = CARD_Create (slot, filename, blocks, &CardFile);
|
||||
// if (CardError)
|
||||
// {
|
||||
// CARD_Unmount (slot);
|
||||
// WaitPrompt ("Unable to create updated card file!");
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// else
|
||||
|
||||
if ( (s32)blocks > CardFile.len ) /*** new data is longer ***/
|
||||
{
|
||||
CARD_Close (&CardFile);
|
||||
|
||||
/*** Try to create temp file to check available space ***/
|
||||
CardError = CARD_Create (slot, "TEMPFILESNES9XGX201", blocks, &CardFile);
|
||||
if (CardError)
|
||||
{
|
||||
CARD_Unmount (slot);
|
||||
WaitPrompt ("Not enough space to update file!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*** Delete the temporary file ***/
|
||||
CARD_Close (&CardFile);
|
||||
CardError = CARD_Delete(slot, "TEMPFILESNES9XGX201");
|
||||
if (CardError)
|
||||
{
|
||||
CARD_Unmount (slot);
|
||||
WaitPrompt ("Unable to delete temporary file!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*** Delete the existing shorter file ***/
|
||||
CardError = CARD_Delete(slot, filename);
|
||||
if (CardError)
|
||||
{
|
||||
CARD_Unmount (slot);
|
||||
WaitPrompt ("Unable to delete existing file!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*** Create new, longer file ***/
|
||||
CardError = CARD_Create (slot, filename, blocks, &CardFile);
|
||||
if (CardError)
|
||||
{
|
||||
CARD_Unmount (slot);
|
||||
WaitPrompt ("Unable to create updated card file!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else /*** no file existed, create new one ***/
|
||||
{
|
||||
/*** Create new file ***/
|
||||
CardError = CARD_Create (slot, filename, blocks, &CardFile);
|
||||
if (CardError)
|
||||
{
|
||||
CARD_Unmount (slot);
|
||||
if ( CardError = CARD_ERROR_INSSPACE )
|
||||
WaitPrompt ("Not enough space to create file!");
|
||||
else
|
||||
WaitPrompt ("Unable to create card file!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*** Now, have an open file handle, ready to send out the data ***/
|
||||
CARD_GetStatus (slot, CardFile.filenum, &CardStatus);
|
||||
CardStatus.icon_addr = 0x0;
|
||||
CardStatus.icon_fmt = 2;
|
||||
CardStatus.icon_speed = 1;
|
||||
CardStatus.comment_addr = 2048;
|
||||
CARD_SetStatus (slot, CardFile.filenum, &CardStatus);
|
||||
|
||||
int byteswritten = 0;
|
||||
int bytesleft = blocks;
|
||||
while (bytesleft > 0)
|
||||
{
|
||||
CardError =
|
||||
CARD_Write (&CardFile, buf + byteswritten,
|
||||
SectorSize, byteswritten);
|
||||
bytesleft -= SectorSize;
|
||||
byteswritten += SectorSize;
|
||||
|
||||
sprintf (msg, "Wrote %d of %d bytes", byteswritten, blocks);
|
||||
ShowProgress (msg, byteswritten, blocks);
|
||||
}
|
||||
|
||||
CARD_Close (&CardFile);
|
||||
CARD_Unmount (slot);
|
||||
|
||||
if ( GCSettings.VerifySaves )
|
||||
{
|
||||
/*** Verify the written file, but only up to the length we wrote
|
||||
because the file could be longer due to past writes ***/
|
||||
if ( VerifyMCFile (buf, slot, filename, byteswritten) )
|
||||
return byteswritten;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return byteswritten;
|
||||
}
|
||||
else
|
||||
if ( !silent )
|
||||
WaitPrompt ("This game does not appear to use SRAM");
|
||||
}
|
||||
else
|
||||
if (slot == CARD_SLOTA)
|
||||
WaitPrompt ("Unable to Mount Slot A Memory Card!");
|
||||
else
|
||||
WaitPrompt ("Unable to Mount Slot B Memory Card!");
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Memory Card SRAM Load
|
||||
****************************************************************************/
|
||||
void
|
||||
LoadSRAMFromMC (int slot, int silent)
|
||||
{
|
||||
char filename[128];
|
||||
|
||||
ShowAction ("Loading SRAM from MC...");
|
||||
|
||||
/*** Build SRAM filename ***/
|
||||
sprintf (filename, "%s.srm", Memory.ROMName);
|
||||
|
||||
int offset = LoadBufferFromMC (savebuffer, slot, filename, silent);
|
||||
|
||||
if ( offset > 0 )
|
||||
{
|
||||
decodesavedata (offset);
|
||||
if ( !silent )
|
||||
{
|
||||
sprintf (filename, "Loaded %d bytes", offset);
|
||||
WaitPrompt (filename);
|
||||
}
|
||||
S9xSoftReset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Memory Card SRAM Save
|
||||
****************************************************************************/
|
||||
void
|
||||
SaveSRAMToMC (int slot, int silent)
|
||||
{
|
||||
char filename[128];
|
||||
int datasize;
|
||||
int offset;
|
||||
|
||||
ShowAction ("Saving SRAM to MC...");
|
||||
|
||||
/*** Build SRAM filename ***/
|
||||
sprintf (filename, "%s.srm", Memory.ROMName);
|
||||
|
||||
datasize = prepareMCsavedata ();
|
||||
offset = SaveBufferToMC (savebuffer, slot, filename, datasize, silent);
|
||||
|
||||
if ( (offset > 0) && (!silent))
|
||||
{
|
||||
sprintf (filename, "Wrote %d bytes", offset);
|
||||
WaitPrompt (filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Memory Card Preferences Load
|
||||
****************************************************************************/
|
||||
void
|
||||
LoadPrefsFromMC (int slot, int silent)
|
||||
{
|
||||
int offset;
|
||||
char msg[80];
|
||||
|
||||
ShowAction ("Loading Prefs from MC...");
|
||||
|
||||
offset = LoadBufferFromMC (savebuffer, slot, PREFS_FILE_NAME, silent);
|
||||
|
||||
if ( offset > 0 )
|
||||
{
|
||||
decodePrefsData ();
|
||||
if ( !silent )
|
||||
{
|
||||
sprintf (msg, "Loaded %d bytes", offset);
|
||||
WaitPrompt (msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Memory Card Preferences Save
|
||||
****************************************************************************/
|
||||
void
|
||||
SavePrefsToMC (int slot, int silent)
|
||||
{
|
||||
int datasize;
|
||||
int offset;
|
||||
char msg[80];
|
||||
|
||||
ShowAction ("Saving Prefs to MC...");
|
||||
|
||||
datasize = preparePrefsData ();
|
||||
offset = SaveBufferToMC (savebuffer, slot, PREFS_FILE_NAME, datasize, silent);
|
||||
|
||||
if ( offset > 0 && !silent)
|
||||
{
|
||||
sprintf (msg, "Wrote %d bytes", offset);
|
||||
WaitPrompt (msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
31
source/ngc/mcsave.h
Normal file
31
source/ngc/mcsave.h
Normal file
@ -0,0 +1,31 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
*
|
||||
* mcsave.cpp
|
||||
*
|
||||
* Memory Card Save Routines.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _NGCMCSAVE_
|
||||
#define _NGCMCSAVE_
|
||||
|
||||
#define SAVEBUFFERSIZE ((512 * 1024) + 2048 + 64 + 4 + 4)
|
||||
|
||||
void ClearSaveBuffer ();
|
||||
|
||||
int VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize);
|
||||
|
||||
int LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent);
|
||||
int SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool8 silent);
|
||||
|
||||
void LoadSRAMFromMC (int slot, int silent);
|
||||
void SaveSRAMToMC (int slot, int silent);
|
||||
|
||||
void LoadPrefsFromMC (int slot, int silent);
|
||||
void SavePrefsToMC (int slot, int silent);
|
||||
|
||||
#endif
|
488
source/ngc/memfile.cpp
Normal file
488
source/ngc/memfile.cpp
Normal file
@ -0,0 +1,488 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50 - GX 2.0
|
||||
*
|
||||
* NGC Snapshots Memory File System
|
||||
*
|
||||
* This is a single global memory file controller. Don't even think of opening two
|
||||
* at the same time !
|
||||
*
|
||||
* There's just enough here to do SnapShots - you should add anything else you
|
||||
* need.
|
||||
*
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007-July 2007
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sdcard.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#include "memfile.h"
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "soundux.h"
|
||||
#include "snapshot.h"
|
||||
#include "srtc.h"
|
||||
|
||||
#include "Snes9xGx.h"
|
||||
#include "filesel.h"
|
||||
#include "ftfont.h"
|
||||
#include "smbload.h"
|
||||
#include "mcsave.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "smb.h"
|
||||
}
|
||||
|
||||
#define MEMBUFFER (512 * 1024)
|
||||
|
||||
extern void S9xSRTCPreSaveState ();
|
||||
extern void NGCFreezeStruct ();
|
||||
extern bool8 S9xUnfreezeGame (const char *filename);
|
||||
extern unsigned char savebuffer[];
|
||||
|
||||
static int bufoffset;
|
||||
static char membuffer[MEMBUFFER];
|
||||
|
||||
char freezecomment[2][32] = { {"Snes9x GX 2.0.1b8 Freeze"}, {"Freeze"} };
|
||||
|
||||
|
||||
/**
|
||||
* GetMem
|
||||
*
|
||||
* Return x bytes from memory buffer
|
||||
*/
|
||||
int
|
||||
GetMem (char *buffer, int len)
|
||||
{
|
||||
memcpy (buffer, membuffer + bufoffset, len);
|
||||
bufoffset += len;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* PutMem
|
||||
*
|
||||
* Put some values in memory buffer
|
||||
*/
|
||||
static void
|
||||
PutMem (char *buffer, int len)
|
||||
{
|
||||
memcpy (membuffer + bufoffset, buffer, len);
|
||||
bufoffset += len;
|
||||
}
|
||||
|
||||
void
|
||||
NGCFreezeBlock (char *name, uint8 * block, int size)
|
||||
{
|
||||
char buffer[512];
|
||||
|
||||
// char msg[90];
|
||||
// sprintf (msg, "name=%s", name);
|
||||
// WaitPrompt(msg);
|
||||
|
||||
sprintf (buffer, "%s:%06d:", name, size);
|
||||
PutMem (buffer, strlen (buffer));
|
||||
PutMem ((char *) block, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* NGCFreezeMembuffer
|
||||
*/
|
||||
static int
|
||||
NGCFreezeMemBuffer ()
|
||||
{
|
||||
int i;
|
||||
char buffer[1024];
|
||||
|
||||
bufoffset = 0;
|
||||
|
||||
S9xUpdateRTC ();
|
||||
S9xSRTCPreSaveState ();
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
SoundData.channels[i].previous16[0] =
|
||||
(int16) SoundData.channels[i].previous[0];
|
||||
SoundData.channels[i].previous16[1] =
|
||||
(int16) SoundData.channels[i].previous[1];
|
||||
}
|
||||
|
||||
sprintf (buffer, "%s:%04d\n", SNAPSHOT_MAGIC, SNAPSHOT_VERSION);
|
||||
PutMem (buffer, strlen (buffer));
|
||||
sprintf (buffer, "NAM:%06d:%s%c", (int) strlen (Memory.ROMFilename) + 1,
|
||||
Memory.ROMFilename, 0);
|
||||
|
||||
PutMem (buffer, strlen (buffer) + 1);
|
||||
|
||||
NGCFreezeStruct ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* NGCFreezeGame
|
||||
*
|
||||
* Do freeze game for Nintendo Gamecube
|
||||
*/
|
||||
int
|
||||
NGCFreezeGame (int where, bool8 silent)
|
||||
{
|
||||
char filename[1024];
|
||||
SMBFILE smbfile;
|
||||
sd_file *handle;
|
||||
int len = 0;
|
||||
int wrote = 0;
|
||||
int offset = 0;
|
||||
char msg[100];
|
||||
|
||||
if (where == 4)
|
||||
{
|
||||
/*** Freeze to SMB ***/
|
||||
sprintf (filename, "\\%s\\%s.frz", SNESSAVEDIR, Memory.ROMName);
|
||||
}
|
||||
else if (where == 2 || where == 3)
|
||||
{
|
||||
/*** Freeze to SDCard in slot A or slot B ***/
|
||||
SDCARD_Init ();
|
||||
|
||||
#ifdef SDUSE_LFN
|
||||
sprintf (filename, "dev%d:\\%s\\%s.frz", where-2, SNESSAVEDIR, Memory.ROMName);
|
||||
#else
|
||||
/*** Until we have LFN on SD ... ***/
|
||||
sprintf (filename, "dev%d:\\%s\\%08x.frz", where-2, SNESSAVEDIR, Memory.ROMCRC32);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/*** Freeze to MC in slot A or slot B ***/
|
||||
sprintf (filename, "%s.snz", Memory.ROMName);
|
||||
}
|
||||
|
||||
S9xSetSoundMute (TRUE);
|
||||
S9xPrepareSoundForSnapshotSave (FALSE);
|
||||
|
||||
NGCFreezeMemBuffer ();
|
||||
|
||||
S9xPrepareSoundForSnapshotSave (TRUE);
|
||||
S9xSetSoundMute (FALSE);
|
||||
|
||||
if (where == 4) /*** SMB ***/
|
||||
{
|
||||
ConnectSMB ();
|
||||
|
||||
smbfile = SMB_Open (filename, SMB_OPEN_WRITING | SMB_DENY_NONE,
|
||||
SMB_OF_CREATE | SMB_OF_TRUNCATE);
|
||||
|
||||
if (smbfile)
|
||||
{
|
||||
ShowAction ("Saving freeze game...");
|
||||
|
||||
len = bufoffset;
|
||||
offset = 0;
|
||||
while (len > 0)
|
||||
{
|
||||
if (len > 1024)
|
||||
wrote =
|
||||
SMB_Write ((char *) membuffer + offset, 1024, offset,
|
||||
smbfile);
|
||||
else
|
||||
wrote =
|
||||
SMB_Write ((char *) membuffer + offset, len, offset,
|
||||
smbfile);
|
||||
|
||||
offset += wrote;
|
||||
len -= wrote;
|
||||
}
|
||||
|
||||
SMB_Close (smbfile);
|
||||
|
||||
if ( !silent )
|
||||
{
|
||||
sprintf (filename, "Written %d bytes", bufoffset);
|
||||
WaitPrompt (filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "Couldn't save to SMB:\\%s\\", SNESSAVEDIR);
|
||||
WaitPrompt (msg);
|
||||
}
|
||||
}
|
||||
else if (where == 2 || where == 3) /*** SDCard slot A or slot B ***/
|
||||
{
|
||||
handle = SDCARD_OpenFile (filename, "wb");
|
||||
|
||||
if (handle > 0)
|
||||
{
|
||||
ShowAction ("Saving freeze game...");
|
||||
|
||||
len = SDCARD_WriteFile (handle, membuffer, bufoffset);
|
||||
SDCARD_CloseFile (handle);
|
||||
|
||||
if (len != bufoffset)
|
||||
WaitPrompt ("Error writing freeze file");
|
||||
else if ( !silent )
|
||||
{
|
||||
sprintf (filename, "Written %d bytes", bufoffset);
|
||||
WaitPrompt (filename);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(msg, "Couldn't save to dev%d:\\%s\\", where-2, SNESSAVEDIR);
|
||||
WaitPrompt (msg);
|
||||
}
|
||||
}
|
||||
else /*** MC in slot A or slot B ***/
|
||||
{
|
||||
ShowAction ("Saving freeze game...");
|
||||
|
||||
ClearSaveBuffer ();
|
||||
|
||||
/*** Copy in save icon ***/
|
||||
int offset = sizeof (saveicon);
|
||||
memcpy (savebuffer, saveicon, offset);
|
||||
|
||||
/*** And the freezecomment ***/
|
||||
sprintf (freezecomment[1], "%s", Memory.ROMName);
|
||||
memcpy (savebuffer + offset, freezecomment, 64);
|
||||
offset += 64;
|
||||
|
||||
/*** Zip and copy in the freeze ***/
|
||||
uLongf DestBuffSize = (uLongf) SAVEBUFFERSIZE;
|
||||
int err= compress2((Bytef*)(savebuffer+offset+8), (uLongf*)&DestBuffSize, (const Bytef*)membuffer, (uLongf)bufoffset, Z_BEST_COMPRESSION);
|
||||
|
||||
if(err!=Z_OK)
|
||||
{
|
||||
sprintf (msg, "zip error %s ",zError(err));
|
||||
WaitPrompt (msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zippedsize = (int)DestBuffSize;
|
||||
memcpy (savebuffer + offset, &zippedsize, 4);
|
||||
offset += 4;
|
||||
|
||||
int decompressedsize = (int)bufoffset;
|
||||
memcpy (savebuffer + offset, &decompressedsize, 4);
|
||||
offset += 4;
|
||||
|
||||
offset += zippedsize;
|
||||
|
||||
int ret = SaveBufferToMC ( savebuffer, where, filename, offset, SILENT );
|
||||
if ( ret && !silent )
|
||||
{
|
||||
sprintf (filename, "Written %d bytes", ret);
|
||||
WaitPrompt (filename);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* NGCUnFreezeBlock
|
||||
*/
|
||||
int
|
||||
NGCUnFreezeBlock (char *name, uint8 * block, int size)
|
||||
{
|
||||
char buffer[20], *e;
|
||||
int len = 0;
|
||||
int rem = 0;
|
||||
|
||||
GetMem (buffer, 11);
|
||||
|
||||
if (strncmp (buffer, name, 3) != 0 || buffer[3] != ':' ||
|
||||
buffer[10] != ':' || (len = strtol (&buffer[4], &e, 10)) == 0 ||
|
||||
e != buffer + 10)
|
||||
{
|
||||
return WRONG_FORMAT;
|
||||
}
|
||||
|
||||
if (len > size)
|
||||
{
|
||||
rem = len - size;
|
||||
len = size;
|
||||
}
|
||||
|
||||
ZeroMemory (block, size);
|
||||
|
||||
GetMem ((char *) block, len);
|
||||
|
||||
if (rem)
|
||||
{
|
||||
bufoffset += rem;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* NGCUnfreezeGame
|
||||
*/
|
||||
int
|
||||
NGCUnfreezeGame (int from, bool8 silent)
|
||||
{
|
||||
char filename[1024];
|
||||
SMBFILE smbfile;
|
||||
sd_file *handle;
|
||||
int read = 0;
|
||||
int offset = 0;
|
||||
char msg[80];
|
||||
|
||||
bufoffset = 0;
|
||||
|
||||
if (from == 4)
|
||||
{
|
||||
/*** From SMB ***/
|
||||
sprintf (filename, "\\%s\\%s.frz", SNESSAVEDIR, Memory.ROMName);
|
||||
ConnectSMB ();
|
||||
|
||||
/*** Read the file into memory ***/
|
||||
smbfile =
|
||||
SMB_Open (filename, SMB_OPEN_READING | SMB_DENY_NONE, SMB_OF_OPEN);
|
||||
|
||||
if (smbfile)
|
||||
{
|
||||
ShowAction ("Loading freeze file...");
|
||||
while ((read =
|
||||
SMB_Read ((char *) membuffer + offset, 1024, offset,
|
||||
smbfile)) > 0)
|
||||
offset += read;
|
||||
|
||||
SMB_Close (smbfile);
|
||||
|
||||
ShowAction ("Unpacking freeze file");
|
||||
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
|
||||
{
|
||||
WaitPrompt ("Error thawing");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if ( !silent )
|
||||
{
|
||||
WaitPrompt ("No freeze file found");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (from == 2 || from == 3) /*** From SD slot A or slot B ***/
|
||||
{
|
||||
SDCARD_Init ();
|
||||
|
||||
#ifdef SDUSE_LFN
|
||||
sprintf (filename, "dev%d:\\%s\\%s.frz", from-2, SNESSAVEDIR, Memory.ROMName);
|
||||
#else
|
||||
/*** From SDCard ***/
|
||||
sprintf (filename, "dev%d:\\%s\\%08x.frz", from-2, SNESSAVEDIR, Memory.ROMCRC32);
|
||||
#endif
|
||||
|
||||
handle = SDCARD_OpenFile (filename, "rb");
|
||||
|
||||
if (handle > 0)
|
||||
{
|
||||
ShowAction ("Loading freeze file...");
|
||||
|
||||
offset = 0;
|
||||
/*** Usual chunks into memory ***/
|
||||
while ((read = SDCARD_ReadFile (handle, membuffer + offset, 2048)) >
|
||||
0)
|
||||
offset += read;
|
||||
|
||||
SDCARD_CloseFile (handle);
|
||||
|
||||
ShowAction ("Unpacking freeze file");
|
||||
|
||||
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
|
||||
{
|
||||
WaitPrompt ("Error thawing");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if ( !silent )
|
||||
{
|
||||
WaitPrompt ("No freeze file found");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else /*** From MC in slot A or slot B ***/
|
||||
{
|
||||
ShowAction ("Loading freeze file...");
|
||||
|
||||
sprintf (filename, "%s.snz", Memory.ROMName);
|
||||
|
||||
int ret = LoadBufferFromMC ( savebuffer, from, filename, silent );
|
||||
if ( ret )
|
||||
{
|
||||
ShowAction ("Unpacking freeze file");
|
||||
|
||||
// skip the saveicon and comment
|
||||
offset = (sizeof(saveicon) + 64);
|
||||
uLongf zipsize = 0;
|
||||
uLongf decompressedsize = 0;
|
||||
|
||||
memcpy (&zipsize, savebuffer+offset, 4);
|
||||
offset += 4;
|
||||
|
||||
memcpy (&decompressedsize, savebuffer+offset, 4);
|
||||
offset += 4;
|
||||
|
||||
memset(membuffer, 0, MEMBUFFER);
|
||||
|
||||
uLongf DestBuffSize = MEMBUFFER;
|
||||
int err= uncompress((Bytef*)membuffer, (uLongf*)&DestBuffSize, (const Bytef*)(savebuffer + offset), zipsize);
|
||||
|
||||
if ( err!=Z_OK )
|
||||
{
|
||||
sprintf (msg, "unzip error %s ",zError(err));
|
||||
WaitPrompt (msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( DestBuffSize != decompressedsize )
|
||||
{
|
||||
WaitPrompt ("Unzipped size doesn't match expected size!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
|
||||
{
|
||||
WaitPrompt ("Error thawing");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if ( !silent )
|
||||
{
|
||||
sprintf(msg, "Couldn't load from MC slot %s", (from ? "B" : "A"));
|
||||
WaitPrompt (msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void quickLoadFreeze (bool8 silent)
|
||||
{
|
||||
if ( QUICK_SAVE_SLOT >= 0 )
|
||||
NGCUnfreezeGame ( QUICK_SAVE_SLOT, silent );
|
||||
}
|
||||
|
||||
|
||||
void quickSaveFreeze (bool8 silent)
|
||||
{
|
||||
if ( QUICK_SAVE_SLOT >= 0 )
|
||||
NGCFreezeGame ( QUICK_SAVE_SLOT, silent );
|
||||
}
|
||||
|
||||
|
34
source/ngc/memfile.h
Normal file
34
source/ngc/memfile.h
Normal file
@ -0,0 +1,34 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50 - GX 2.0
|
||||
*
|
||||
* NGC Snapshots Memory File System
|
||||
*
|
||||
* This is a single global memory file controller. Don't even think of opening two
|
||||
* at the same time !
|
||||
*
|
||||
* There's just enough here to do SnapShots - you should add anything else you
|
||||
* need.
|
||||
****************************************************************************/
|
||||
#include "snes9x.h"
|
||||
|
||||
#ifndef _NGCMEMFILE_
|
||||
#define _NGCMEMFILE_
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char filename[512]; /*** Way over size - but who cares -;) ***/
|
||||
int filehandle;
|
||||
int currpos;
|
||||
int length;
|
||||
int mode;
|
||||
char *buffer; /*** Memspace for read / write ***/
|
||||
}
|
||||
MEMFILE;
|
||||
|
||||
int NGCFreezeGame (int where, bool8 silent);
|
||||
int NGCUnfreezeGame (int from, bool8 silent);
|
||||
|
||||
void quickLoadFreeze (bool8 silent);
|
||||
void quickSaveFreeze (bool8 silent);
|
||||
|
||||
#endif
|
666
source/ngc/menu.cpp
Normal file
666
source/ngc/menu.cpp
Normal file
@ -0,0 +1,666 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Menu
|
||||
*
|
||||
* softdev July 2006
|
||||
* crunchy2 May-June 2007
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "snes9x.h"
|
||||
#include "snes9xGx.h"
|
||||
#include "memmap.h"
|
||||
#include "debug.h"
|
||||
#include "cpuexec.h"
|
||||
#include "ppu.h"
|
||||
#include "apu.h"
|
||||
#include "display.h"
|
||||
#include "gfx.h"
|
||||
#include "soundux.h"
|
||||
#include "spc700.h"
|
||||
#include "spc7110.h"
|
||||
#include "controls.h"
|
||||
#include "aram.h"
|
||||
#include "ftfont.h"
|
||||
#include "video.h"
|
||||
#include "mcsave.h"
|
||||
#include "filesel.h"
|
||||
#include "ngcunzip.h"
|
||||
#include "smbload.h"
|
||||
#include "mcsave.h"
|
||||
#include "sdload.h"
|
||||
#include "memfile.h"
|
||||
#include "dvd.h"
|
||||
#include "s9xconfig.h"
|
||||
#include "sram.h"
|
||||
#include "preferences.h"
|
||||
|
||||
#define PSOSDLOADID 0x7c6000a6
|
||||
extern int menu;
|
||||
extern unsigned long ARAM_ROMSIZE;
|
||||
|
||||
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Freeze Manager
|
||||
****************************************************************************/
|
||||
int freezecountwii = 9;
|
||||
char freezemenuwii[][20] = { "Freeze to MC Slot A", "Thaw from MC Slot A",
|
||||
"Freeze to MC Slot B", "Thaw from MC Slot B",
|
||||
"Freeze to SD Slot A", "Thaw from SD Slot A",
|
||||
"Freeze to SD Slot B", "Thaw from SD Slot B",
|
||||
"Return to previous"
|
||||
};
|
||||
int freezecount = 11;
|
||||
char freezemenu[][20] = { "Freeze to MC Slot A", "Thaw from MC Slot A",
|
||||
"Freeze to MC Slot B", "Thaw from MC Slot B",
|
||||
"Freeze to SD Slot A", "Thaw from SD Slot A",
|
||||
"Freeze to SD Slot B", "Thaw from SD Slot B",
|
||||
"Freeze to SMB", "Thaw from SMB",
|
||||
"Return to previous"
|
||||
};
|
||||
int
|
||||
FreezeManager ()
|
||||
{
|
||||
int ret;
|
||||
int loaded = 0;
|
||||
int quit = 0;
|
||||
int oldmenu = menu;
|
||||
menu = 0;
|
||||
|
||||
|
||||
while (quit == 0)
|
||||
{
|
||||
if ( isWii ) /* Wii menu */
|
||||
{
|
||||
ret = RunMenu (freezemenuwii, freezecountwii, "Freeze Manager");
|
||||
if (ret >= freezecountwii-1)
|
||||
ret = freezecount-1;
|
||||
}
|
||||
else /* Gamecube menu */
|
||||
ret = RunMenu (freezemenu, freezecount, "Freeze Manager");
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case 0:/*** Freeze to MC in slot A ***/
|
||||
NGCFreezeGame (0, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 1:/*** Thaw from MC in slot A ***/
|
||||
quit = loaded = NGCUnfreezeGame (0, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 2:/*** Freeze to MC in slot B ***/
|
||||
NGCFreezeGame (1, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 3:/*** Thaw from MC in slot B ***/
|
||||
quit = loaded = NGCUnfreezeGame (1, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 4:/*** Freeze to SDCard in slot A ***/
|
||||
NGCFreezeGame (2, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 5:/*** Thaw from SDCard in slot A ***/
|
||||
quit = loaded = NGCUnfreezeGame (2, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 6:/*** Freeze to SDCard in slot B ***/
|
||||
NGCFreezeGame (3, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 7:/*** Thaw from SDCard in slot B ***/
|
||||
quit = loaded = NGCUnfreezeGame (3, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 8:/*** Freeze to SMB ***/
|
||||
if ( !isWii )
|
||||
NGCFreezeGame (4, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 9:/*** Thaw from SMB ***/
|
||||
if ( !isWii )
|
||||
quit = loaded = NGCUnfreezeGame (4, NOTSILENT);
|
||||
break;
|
||||
|
||||
case -1: /*** Button B ***/
|
||||
case 10:
|
||||
quit = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
menu = oldmenu;
|
||||
return loaded;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Load Manager
|
||||
****************************************************************************/
|
||||
int loadmancountwii = 4;
|
||||
char loadmanwii[][20] = { "Load from DVD", "Load from SD Slot A",
|
||||
"Load from SD Slot B", "Return to previous"
|
||||
};
|
||||
int loadmancount = 5;
|
||||
char loadman[][20] = { "Load from DVD", "Load from SD Slot A",
|
||||
"Load from SD Slot B", "Load from SMB", "Return to previous"
|
||||
};
|
||||
int
|
||||
LoadManager ()
|
||||
{
|
||||
int ret;
|
||||
int quit = 0;
|
||||
int oldmenu = menu;
|
||||
int retval = 0;
|
||||
menu = 0;
|
||||
|
||||
while (quit == 0)
|
||||
{
|
||||
if ( LOAD_TYPE )
|
||||
ret = LOAD_TYPE-1;
|
||||
else
|
||||
{
|
||||
if ( isWii ) /* Wii menu */
|
||||
{
|
||||
ret = RunMenu (loadmanwii, loadmancountwii, "Load Manager");
|
||||
if (ret >= loadmancountwii-1)
|
||||
ret = loadmancount-1;
|
||||
}
|
||||
else /* Gamecube menu */
|
||||
ret = RunMenu (loadman, loadmancount, "Load Manager");
|
||||
}
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case 0:
|
||||
/*** Load from DVD ***/
|
||||
retval = OpenDVD ();
|
||||
if ( LOAD_TYPE )
|
||||
quit = 1;
|
||||
else
|
||||
quit = retval;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
retval = OpenSD (CARD_SLOTA);
|
||||
if ( LOAD_TYPE )
|
||||
quit = 1;
|
||||
else
|
||||
quit = retval;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
retval = OpenSD (CARD_SLOTB);
|
||||
if ( LOAD_TYPE )
|
||||
quit = 1;
|
||||
else
|
||||
quit = retval;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
retval = OpenSMB ();
|
||||
if ( LOAD_TYPE )
|
||||
quit = 1;
|
||||
else
|
||||
quit = retval;
|
||||
break;
|
||||
|
||||
case -1: /*** Button B ***/
|
||||
case 4:
|
||||
retval = 0;
|
||||
quit = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
menu = oldmenu;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Save Manager
|
||||
****************************************************************************/
|
||||
int savecountwii = 9;
|
||||
char savemenuwii[][20] = { "Save to MC SLOT A", "Load from MC SLOT A",
|
||||
"Save to MC SLOT B", "Load from MC SLOT B",
|
||||
"Save to SD Slot A", "Load from SD Slot A",
|
||||
"Save to SD Slot B", "Load from SD Slot B",
|
||||
"Return to previous"
|
||||
};
|
||||
int savecount = 11;
|
||||
char savemenu[][20] = { "Save to MC SLOT A", "Load from MC SLOT A",
|
||||
"Save to MC SLOT B", "Load from MC SLOT B",
|
||||
"Save to SD Slot A", "Load from SD Slot A",
|
||||
"Save to SD Slot B", "Load from SD Slot B",
|
||||
"Save to SMB", "Load from SMB",
|
||||
"Return to previous"
|
||||
};
|
||||
void
|
||||
SaveManager ()
|
||||
{
|
||||
int ret;
|
||||
int quit = 0;
|
||||
int oldmenu = menu;
|
||||
menu = 0;
|
||||
|
||||
while (quit == 0)
|
||||
{
|
||||
if ( isWii ) /* Wii menu */
|
||||
{
|
||||
ret = RunMenu (savemenuwii, savecountwii, "Save Manager");
|
||||
if (ret >= savecountwii-1)
|
||||
ret = savecount-1;
|
||||
}
|
||||
else /* Gamecube menu */
|
||||
ret = RunMenu (savemenu, savecount, "Save Manager");
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case 0:
|
||||
/*** Save to MC slot A ***/
|
||||
SaveSRAMToMC (CARD_SLOTA, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/*** Load from MC slot A ***/
|
||||
LoadSRAMFromMC (CARD_SLOTA, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/*** Save to MC slot B ***/
|
||||
SaveSRAMToMC (CARD_SLOTB, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/*** Load from MC slot B ***/
|
||||
LoadSRAMFromMC (CARD_SLOTB, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
/*** Save to SD slot A ***/
|
||||
SaveSRAMToSD (CARD_SLOTA, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
/*** Load from SD slot A ***/
|
||||
LoadSRAMFromSD (CARD_SLOTA, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
/*** Save to SD slot B ***/
|
||||
SaveSRAMToSD (CARD_SLOTB, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
/*** Load from SD slot B ***/
|
||||
LoadSRAMFromSD (CARD_SLOTB, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
/*** Save to SMB **/
|
||||
SaveSRAMToSMB (NOTSILENT);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
/*** Load from SMB ***/
|
||||
LoadSRAMFromSMB (NOTSILENT);
|
||||
break;
|
||||
|
||||
case -1: /*** Button B ***/
|
||||
case 10:
|
||||
/*** Return ***/
|
||||
quit = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
menu = oldmenu;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Emulator Options
|
||||
****************************************************************************/
|
||||
static int emuCount = 11;
|
||||
static char emulatorOptions[][20] = { "Reverse Stereo OFF",
|
||||
"Interp. Sound ON", "Transparency ON", "FPS Display OFF",
|
||||
"MultiTap 5 OFF", "C-Stick Zoom OFF",
|
||||
"Auto Load OFF", "Auto Save OFF", "Verify MC Saves OFF",
|
||||
"Save Prefs Now", "Return to previous"
|
||||
};
|
||||
|
||||
void
|
||||
EmulatorOptions ()
|
||||
{
|
||||
int ret = 0;
|
||||
int quit = 0;
|
||||
int oldmenu = menu;
|
||||
menu = 0;
|
||||
|
||||
while (quit == 0)
|
||||
{
|
||||
sprintf (emulatorOptions[0], "Reverse Stereo %s",
|
||||
Settings.ReverseStereo == true ? " ON" : "OFF");
|
||||
|
||||
sprintf (emulatorOptions[1], "Interp. Sound %s",
|
||||
Settings.InterpolatedSound == true ? " ON" : "OFF");
|
||||
|
||||
sprintf (emulatorOptions[2], "Transparency %s",
|
||||
Settings.Transparency == true ? " ON" : "OFF");
|
||||
|
||||
sprintf (emulatorOptions[3], "FPS Display %s",
|
||||
Settings.DisplayFrameRate == true ? " ON" : "OFF");
|
||||
|
||||
sprintf (emulatorOptions[4], "MultiTap 5 %s",
|
||||
Settings.MultiPlayer5Master == true ? " ON" : "OFF");
|
||||
|
||||
sprintf (emulatorOptions[5], "C-Stick Zoom %s",
|
||||
GCSettings.NGCZoom == true ? " ON" : "OFF");
|
||||
|
||||
if (GCSettings.AutoLoad == 0) sprintf (emulatorOptions[6],"Auto Load OFF");
|
||||
else if (GCSettings.AutoLoad == 1) sprintf (emulatorOptions[6],"Auto Load SRAM");
|
||||
else if (GCSettings.AutoLoad == 2) sprintf (emulatorOptions[6],"Auto Load FREEZE");
|
||||
|
||||
if (GCSettings.AutoSave == 0) sprintf (emulatorOptions[7],"Auto Save OFF");
|
||||
else if (GCSettings.AutoSave == 1) sprintf (emulatorOptions[7],"Auto Save SRAM");
|
||||
else if (GCSettings.AutoSave == 2) sprintf (emulatorOptions[7],"Auto Save FREEZE");
|
||||
else if (GCSettings.AutoSave == 3) sprintf (emulatorOptions[7],"Auto Save BOTH");
|
||||
|
||||
sprintf (emulatorOptions[8], "Verify MC Saves %s",
|
||||
GCSettings.VerifySaves == true ? " ON" : "OFF");
|
||||
|
||||
ret = RunMenu (emulatorOptions, emuCount, "Emulator Options");
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case 0:
|
||||
Settings.ReverseStereo =
|
||||
(Settings.ReverseStereo == false ? true : false);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Settings.InterpolatedSound =
|
||||
(Settings.InterpolatedSound == false ? true : false);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Settings.Transparency =
|
||||
(Settings.Transparency == false ? true : false);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Settings.DisplayFrameRate =
|
||||
(Settings.DisplayFrameRate == false ? true : false);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Settings.MultiPlayer5Master =
|
||||
(Settings.MultiPlayer5Master == false ? true : false);
|
||||
|
||||
if (Settings.MultiPlayer5Master)
|
||||
{
|
||||
S9xSetController (1, CTL_MP5, 1, 2, 3, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
S9xSetController (1, CTL_JOYPAD, 1, 0, 0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
GCSettings.NGCZoom =
|
||||
(GCSettings.NGCZoom == false ? true : false);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
GCSettings.AutoLoad ++;
|
||||
if (GCSettings.AutoLoad > 2)
|
||||
GCSettings.AutoLoad = 0;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
GCSettings.AutoSave ++;
|
||||
if (GCSettings.AutoSave > 3)
|
||||
GCSettings.AutoSave = 0;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
GCSettings.VerifySaves =
|
||||
(GCSettings.VerifySaves == false ? true : false);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
quickSavePrefs(NOTSILENT);
|
||||
break;
|
||||
|
||||
case -1: /*** Button B ***/
|
||||
case 10:
|
||||
quit = 1;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
menu = oldmenu;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Configure Joypads
|
||||
*
|
||||
* Snes9x 1.50 uses a cmd system to work out which button has been pressed.
|
||||
* Here, I simply move the designated value to the gcpadmaps array, which saves
|
||||
* on updating the cmd sequences.
|
||||
****************************************************************************/
|
||||
int padcount = 7;
|
||||
char padmenu[][20] = { "SNES BUTTON A - A",
|
||||
"SNES BUTTON B - B",
|
||||
"SNES BUTTON X - X",
|
||||
"SNES BUTTON Y - Y",
|
||||
"ANALOG CLIP - 70",
|
||||
"Save SRAM/Config",
|
||||
"Return to previous"
|
||||
};
|
||||
|
||||
unsigned short padmap[4] = { PAD_BUTTON_A,
|
||||
PAD_BUTTON_B,
|
||||
PAD_BUTTON_X,
|
||||
PAD_BUTTON_Y
|
||||
};
|
||||
int currconfig[4] = { 0, 1, 2, 3 };
|
||||
static char *padnames = "ABXY";
|
||||
|
||||
extern unsigned short gcpadmap[];
|
||||
extern int padcal;
|
||||
|
||||
void
|
||||
ConfigureJoyPads ()
|
||||
{
|
||||
int quit = 0;
|
||||
int ret = 0;
|
||||
int oldmenu = menu;
|
||||
menu = 0;
|
||||
|
||||
while (quit == 0)
|
||||
{
|
||||
/*** Update the menu information ***/
|
||||
for (ret = 0; ret < 4; ret++)
|
||||
padmenu[ret][16] = padnames[currconfig[ret]];
|
||||
|
||||
sprintf (padmenu[4], "ANALOG CLIP - %d", padcal);
|
||||
|
||||
ret = RunMenu (padmenu, padcount, "Configure Joypads");
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case 0:
|
||||
/*** Configure Button A ***/
|
||||
currconfig[0]++;
|
||||
currconfig[0] &= 3;
|
||||
gcpadmap[0] = padmap[currconfig[0]];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/*** Configure Button B ***/
|
||||
currconfig[1]++;
|
||||
currconfig[1] &= 3;
|
||||
gcpadmap[1] = padmap[currconfig[1]];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/*** Configure Button X ***/
|
||||
currconfig[2]++;
|
||||
currconfig[2] &= 3;
|
||||
gcpadmap[2] = padmap[currconfig[2]];
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/*** Configure Button Y ***/
|
||||
currconfig[3]++;
|
||||
currconfig[3] &= 3;
|
||||
gcpadmap[3] = padmap[currconfig[3]];
|
||||
break;
|
||||
|
||||
case 4:
|
||||
/*** Pad Calibration ***/
|
||||
padcal += 5;
|
||||
if (padcal > 80)
|
||||
padcal = 40;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
/*** Quick Save SRAM ***/
|
||||
if ( ARAM_ROMSIZE > 0 )
|
||||
quickSaveSRAM(NOTSILENT);
|
||||
else
|
||||
WaitPrompt ("No ROM loaded - can't save SRAM");
|
||||
|
||||
break;
|
||||
|
||||
case -1: /*** Button B ***/
|
||||
case 6:
|
||||
/*** Return ***/
|
||||
quit = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
menu = oldmenu;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Main Menu
|
||||
****************************************************************************/
|
||||
int menucount = 10;
|
||||
char menuitems[][20] = { "Choose Game",
|
||||
"SRAM Manager", "Freeze Manager",
|
||||
"Configure Joypads", "Emulator Options",
|
||||
"Reset Game", "Stop DVD Drive", "PSO Reload",
|
||||
"Reset Gamecube", "Return to Game"
|
||||
};
|
||||
|
||||
void
|
||||
mainmenu ()
|
||||
{
|
||||
int quit = 0;
|
||||
int ret;
|
||||
int *psoid = (int *) 0x80001800;
|
||||
void (*PSOReload) () = (void (*)()) 0x80001800;
|
||||
|
||||
if ( isWii )
|
||||
sprintf (menuitems[8],"Reset Wii");
|
||||
else
|
||||
sprintf (menuitems[8],"Reset Gamecube");
|
||||
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
while (quit == 0)
|
||||
{
|
||||
ret = RunMenu (menuitems, menucount, "Main Menu");
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case 0:
|
||||
/*** Load ROM Menu ***/
|
||||
quit = LoadManager ();
|
||||
if ( quit ) // if ROM was loaded, load the SRAM & settings
|
||||
{
|
||||
if ( GCSettings.AutoLoad == 1 )
|
||||
quickLoadSRAM ( SILENT );
|
||||
else if ( GCSettings.AutoLoad == 2 )
|
||||
{
|
||||
/*** load SRAM first in order to get joypad config ***/
|
||||
quickLoadSRAM ( SILENT );
|
||||
quickLoadFreeze ( SILENT );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/*** SRAM Manager Menu ***/
|
||||
if ( ARAM_ROMSIZE > 0 )
|
||||
SaveManager ();
|
||||
else
|
||||
WaitPrompt ("No ROM is loaded!");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/*** Do Freeze / Thaw Menu ***/
|
||||
if ( ARAM_ROMSIZE > 0 )
|
||||
quit = FreezeManager ();
|
||||
else
|
||||
WaitPrompt ("No ROM is loaded!");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/*** Configure Joypads ***/
|
||||
ConfigureJoyPads ();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
/*** Emulator Options ***/
|
||||
EmulatorOptions ();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
/*** Soft reset ***/
|
||||
S9xSoftReset ();
|
||||
quit = 1;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
/*** Turn off DVD motor ***/
|
||||
dvd_motor_off();
|
||||
break;
|
||||
|
||||
case 7:
|
||||
/*** PSO Reload ***/
|
||||
if (psoid[0] == PSOSDLOADID)
|
||||
PSOReload ();
|
||||
break;
|
||||
|
||||
case 8:
|
||||
/*** Reset the Gamecube ***/
|
||||
*SOFTRESET_ADR = 0x00000000;
|
||||
break;
|
||||
|
||||
case -1: /*** Button B ***/
|
||||
case 9:
|
||||
/*** Return to Game ***/
|
||||
quit = 1;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*** Remove any still held buttons ***/
|
||||
while( PAD_ButtonsHeld(0) )
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
}
|
15
source/ngc/menu.h
Normal file
15
source/ngc/menu.h
Normal file
@ -0,0 +1,15 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Menu
|
||||
*
|
||||
* softdev July 2006
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _NGCMENU_
|
||||
|
||||
#define _NGCMENU_
|
||||
|
||||
void mainmenu ();
|
||||
|
||||
#endif
|
181
source/ngc/ngc-missing.cpp
Normal file
181
source/ngc/ngc-missing.cpp
Normal file
@ -0,0 +1,181 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
*
|
||||
* ngc_missing.cpp
|
||||
*
|
||||
* This file contains the missing low-level file I/O function definitions.
|
||||
* Note that these are DUMMY functions, and only allow Snes9x to
|
||||
* compile. Where possible, they will return an error signal.
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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 <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*** splitpath function ***/
|
||||
void
|
||||
_splitpath (char const *buffer, char *drive, char *dir, char *fname,
|
||||
char *ext)
|
||||
{
|
||||
return; /*** Do nothing - NGC code should NEVER call a function which relies on it ***/
|
||||
}
|
||||
|
||||
void
|
||||
_makepath (char *filename, const char *drive, const char *dir,
|
||||
const char *fname, const char *ext)
|
||||
{
|
||||
return; /*** Do nothing - NGC code should NEVER call a function which relies on it ***/
|
||||
}
|
||||
|
||||
char *
|
||||
S9xBasename (char *name)
|
||||
{
|
||||
return name;
|
||||
}
|
170
source/ngc/ngcunzip.cpp
Normal file
170
source/ngc/ngcunzip.cpp
Normal file
@ -0,0 +1,170 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Unzip - borrowed from the GPP
|
||||
*
|
||||
* softdev July 2006
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <zlib.h>
|
||||
#include "dvd.h"
|
||||
#include "video.h"
|
||||
#include "ftfont.h"
|
||||
#include "ngcunzip.h"
|
||||
|
||||
/*
|
||||
* PKWare Zip Header - adopted into zip standard
|
||||
*/
|
||||
#define PKZIPID 0x504b0304
|
||||
#define MAXROM 0x500000
|
||||
#define ZIPCHUNK 2048
|
||||
|
||||
/*
|
||||
* Zip files are stored little endian
|
||||
* Support functions for short and int types
|
||||
*/
|
||||
u32
|
||||
FLIP32 (u32 b)
|
||||
{
|
||||
unsigned int c;
|
||||
|
||||
c = (b & 0xff000000) >> 24;
|
||||
c |= (b & 0xff0000) >> 8;
|
||||
c |= (b & 0xff00) << 8;
|
||||
c |= (b & 0xff) << 24;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
u16
|
||||
FLIP16 (u16 b)
|
||||
{
|
||||
u16 c;
|
||||
|
||||
c = (b & 0xff00) >> 8;
|
||||
c |= (b & 0xff) << 8;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* IsZipFile
|
||||
*
|
||||
* Returns TRUE when PKZIPID is first four characters of buffer
|
||||
****************************************************************************/
|
||||
int
|
||||
IsZipFile (char *buffer)
|
||||
{
|
||||
unsigned int *check;
|
||||
|
||||
check = (unsigned int *) buffer;
|
||||
|
||||
if (check[0] == PKZIPID)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* unzip
|
||||
*
|
||||
* It should be noted that there is a limit of 5MB total size for any ROM
|
||||
******************************************************************************/
|
||||
int
|
||||
UnZipBuffer (unsigned char *outbuffer, u64 discoffset, int length)
|
||||
{
|
||||
PKZIPHEADER pkzip;
|
||||
int zipoffset = 0;
|
||||
int zipchunk = 0;
|
||||
char out[ZIPCHUNK];
|
||||
z_stream zs;
|
||||
int res;
|
||||
int bufferoffset = 0;
|
||||
int have = 0;
|
||||
char readbuffer[2048];
|
||||
char msg[128];
|
||||
|
||||
/*** Read Zip Header ***/
|
||||
dvd_read (readbuffer, 2048, discoffset);
|
||||
|
||||
/*** Copy PKZip header to local, used as info ***/
|
||||
memcpy (&pkzip, readbuffer, sizeof (PKZIPHEADER));
|
||||
|
||||
sprintf (msg, "Unzipping %d bytes ... Wait",
|
||||
FLIP32 (pkzip.uncompressedSize));
|
||||
ShowAction (msg);
|
||||
|
||||
/*** Prepare the zip stream ***/
|
||||
memset (&zs, 0, sizeof (z_stream));
|
||||
zs.zalloc = Z_NULL;
|
||||
zs.zfree = Z_NULL;
|
||||
zs.opaque = Z_NULL;
|
||||
zs.avail_in = 0;
|
||||
zs.next_in = Z_NULL;
|
||||
res = inflateInit2 (&zs, -MAX_WBITS);
|
||||
|
||||
if (res != Z_OK)
|
||||
return 0;
|
||||
|
||||
/*** Set ZipChunk for first pass ***/
|
||||
zipoffset =
|
||||
(sizeof (PKZIPHEADER) + FLIP16 (pkzip.filenameLength) +
|
||||
FLIP16 (pkzip.extraDataLength));
|
||||
zipchunk = ZIPCHUNK - zipoffset;
|
||||
|
||||
/*** Now do it! ***/
|
||||
do
|
||||
{
|
||||
zs.avail_in = zipchunk;
|
||||
zs.next_in = (Bytef *) & readbuffer[zipoffset];
|
||||
|
||||
/*** Now inflate until input buffer is exhausted ***/
|
||||
do
|
||||
{
|
||||
zs.avail_out = ZIPCHUNK;
|
||||
zs.next_out = (Bytef *) & out;
|
||||
|
||||
res = inflate (&zs, Z_NO_FLUSH);
|
||||
|
||||
if (res == Z_MEM_ERROR)
|
||||
{
|
||||
inflateEnd (&zs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
have = ZIPCHUNK - zs.avail_out;
|
||||
if (have)
|
||||
{
|
||||
/*** Copy to normal block buffer ***/
|
||||
memcpy (&outbuffer[bufferoffset], &out, have);
|
||||
bufferoffset += have;
|
||||
}
|
||||
|
||||
}
|
||||
while (zs.avail_out == 0);
|
||||
|
||||
/*** Readup the next 2k block ***/
|
||||
zipoffset = 0;
|
||||
zipchunk = ZIPCHUNK;
|
||||
discoffset += 2048;
|
||||
|
||||
dvd_read (readbuffer, 2048, discoffset);
|
||||
}
|
||||
while (res != Z_STREAM_END);
|
||||
|
||||
inflateEnd (&zs);
|
||||
|
||||
if (res == Z_STREAM_END)
|
||||
{
|
||||
if (FLIP32 (pkzip.uncompressedSize) == (u32) bufferoffset)
|
||||
return bufferoffset;
|
||||
else
|
||||
return FLIP32 (pkzip.uncompressedSize);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
35
source/ngc/ngcunzip.h
Normal file
35
source/ngc/ngcunzip.h
Normal file
@ -0,0 +1,35 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Unzip - borrowed from the GPP
|
||||
*
|
||||
* softdev July 2006
|
||||
****************************************************************************/
|
||||
#ifndef _NGCUNZIP_
|
||||
#define _NGCUNZIP_
|
||||
|
||||
extern int IsZipFile (char *buffer);
|
||||
int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, int length);
|
||||
/*
|
||||
* Zip file header definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int zipid __attribute__ ((__packed__)); // 0x04034b50
|
||||
unsigned short zipversion __attribute__ ((__packed__));
|
||||
unsigned short zipflags __attribute__ ((__packed__));
|
||||
unsigned short compressionMethod __attribute__ ((__packed__));
|
||||
unsigned short lastmodtime __attribute__ ((__packed__));
|
||||
unsigned short lastmoddate __attribute__ ((__packed__));
|
||||
unsigned int crc32 __attribute__ ((__packed__));
|
||||
unsigned int compressedSize __attribute__ ((__packed__));
|
||||
unsigned int uncompressedSize __attribute__ ((__packed__));
|
||||
unsigned short filenameLength __attribute__ ((__packed__));
|
||||
unsigned short extraDataLength __attribute__ ((__packed__));
|
||||
}
|
||||
PKZIPHEADER;
|
||||
|
||||
u32 FLIP32 (u32 b);
|
||||
u16 FLIP16 (u16 b);
|
||||
|
||||
#endif
|
125
source/ngc/preferences.cpp
Normal file
125
source/ngc/preferences.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* crunchy2 April 2007-July 2007
|
||||
*
|
||||
* preferences.cpp
|
||||
*
|
||||
* Preferences save/load preferences utilities
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "snes9xGx.h"
|
||||
#include "memmap.h"
|
||||
#include "srtc.h"
|
||||
#include "ftfont.h"
|
||||
#include "mcsave.h"
|
||||
#include "sdload.h"
|
||||
#include "smbload.h"
|
||||
|
||||
extern unsigned char savebuffer[];
|
||||
extern int currconfig[4];
|
||||
|
||||
#define PREFSVERSTRING "Snes9x GX 2.0.1b8 Prefs"
|
||||
|
||||
char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} };
|
||||
|
||||
/****************************************************************************
|
||||
* Prepare Preferences Data
|
||||
*
|
||||
* This sets up the save buffer for saving to a memory card.
|
||||
****************************************************************************/
|
||||
int
|
||||
preparePrefsData ()
|
||||
{
|
||||
int offset = sizeof (saveicon);
|
||||
int size;
|
||||
|
||||
memset (savebuffer, 0, 0x22000);
|
||||
|
||||
/*** Copy in save icon ***/
|
||||
memcpy (savebuffer, saveicon, offset);
|
||||
|
||||
/*** And the prefscomments ***/
|
||||
memcpy (savebuffer + offset, prefscomment, 64);
|
||||
offset += 64;
|
||||
|
||||
/*** Save all settings ***/
|
||||
size = sizeof (Settings);
|
||||
memcpy (savebuffer + offset, &Settings, size);
|
||||
offset += size;
|
||||
|
||||
/*** Save GC specific settings ***/
|
||||
size = sizeof (GCSettings);
|
||||
memcpy (savebuffer + offset, &GCSettings, size);
|
||||
offset += size;
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Decode Preferences Data
|
||||
****************************************************************************/
|
||||
void
|
||||
decodePrefsData ()
|
||||
{
|
||||
int offset;
|
||||
char prefscomment[32];
|
||||
|
||||
offset = sizeof (saveicon);
|
||||
memcpy (prefscomment, savebuffer + offset, 32);
|
||||
|
||||
if ( strcmp (prefscomment, PREFSVERSTRING) == 0 )
|
||||
{
|
||||
offset += 64;
|
||||
memcpy (&Settings, savebuffer + offset, sizeof (Settings));
|
||||
offset += sizeof (Settings);
|
||||
memcpy (&GCSettings, savebuffer + offset, sizeof (GCSettings));
|
||||
}
|
||||
else
|
||||
WaitPrompt("Preferences reset - check settings!");
|
||||
}
|
||||
|
||||
void quickLoadPrefs (bool8 silent)
|
||||
{
|
||||
switch ( QUICK_SAVE_SLOT )
|
||||
{
|
||||
case CARD_SLOTA:
|
||||
case CARD_SLOTB:
|
||||
LoadPrefsFromMC(QUICK_SAVE_SLOT, silent);
|
||||
break;
|
||||
|
||||
case CARD_SLOTA+2:
|
||||
case CARD_SLOTB+2:
|
||||
LoadPrefsFromSD(QUICK_SAVE_SLOT-2, silent);
|
||||
break;
|
||||
|
||||
case CARD_SLOTA+4:
|
||||
LoadPrefsFromSMB(silent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void quickSavePrefs (bool8 silent)
|
||||
{
|
||||
switch ( QUICK_SAVE_SLOT )
|
||||
{
|
||||
case CARD_SLOTA:
|
||||
case CARD_SLOTB:
|
||||
SavePrefsToMC(QUICK_SAVE_SLOT, silent);
|
||||
break;
|
||||
case CARD_SLOTA+2:
|
||||
case CARD_SLOTB+2:
|
||||
SavePrefsToSD(QUICK_SAVE_SLOT-2, silent);
|
||||
break;
|
||||
case CARD_SLOTA+4:
|
||||
SavePrefsToSMB(silent);
|
||||
break;
|
||||
}
|
||||
}
|
18
source/ngc/preferences.h
Normal file
18
source/ngc/preferences.h
Normal file
@ -0,0 +1,18 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* crunchy2 April 2007
|
||||
*
|
||||
* preferences.cpp
|
||||
*
|
||||
* Preferences save/load preferences utilities
|
||||
****************************************************************************/
|
||||
|
||||
#define PREFS_FILE_NAME "snes9xGx.prf"
|
||||
|
||||
int preparePrefsData ();
|
||||
void decodePrefsData ();
|
||||
|
||||
void quickLoadPrefs (bool8 silent);
|
||||
void quickSavePrefs (bool8 silent);
|
239
source/ngc/s9xconfig.cpp
Normal file
239
source/ngc/s9xconfig.cpp
Normal file
@ -0,0 +1,239 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
*
|
||||
* s9xconfig.cpp
|
||||
*
|
||||
* Configuration parameters have been moved here for easier maintenance.
|
||||
* Refer to Snes9x.h for all combinations.
|
||||
* The defaults used here are taken directly from porting.html
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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 <gccore.h>
|
||||
#include "snes9x.h"
|
||||
#include "snes9xGX.h"
|
||||
#include "smbload.h"
|
||||
|
||||
void
|
||||
DefaultSettings ()
|
||||
{
|
||||
/*** Default ALL to false ***/
|
||||
memset (&Settings, 0, sizeof (Settings));
|
||||
|
||||
/*** General ***/
|
||||
Settings.MouseMaster = true;
|
||||
Settings.SuperScopeMaster = true;
|
||||
Settings.MultiPlayer5Master = false;
|
||||
Settings.JustifierMaster = true;
|
||||
Settings.ShutdownMaster = false;
|
||||
Settings.CyclesPercentage = 100; // snes9x 1.50 and earlier
|
||||
|
||||
/* Eke-Eke: specific to snes9x 1.51 */
|
||||
// Settings.BlockInvalidVRAMAccess = true;
|
||||
// Settings.HDMATimingHack = 100;
|
||||
|
||||
/*** Sound defaults. On GC this is 32Khz/16bit/Stereo/InterpolatedSound ***/
|
||||
Settings.APUEnabled = true;
|
||||
Settings.NextAPUEnabled = true;
|
||||
Settings.SoundPlaybackRate = 32000;
|
||||
Settings.Stereo = true;
|
||||
Settings.SixteenBitSound = true;
|
||||
Settings.SoundEnvelopeHeightReading = true;
|
||||
Settings.DisableSampleCaching = true;
|
||||
Settings.InterpolatedSound = true;
|
||||
Settings.ReverseStereo = false;
|
||||
|
||||
/*** Graphics ***/
|
||||
Settings.Transparency = true;
|
||||
Settings.SupportHiRes = true;
|
||||
Settings.SkipFrames = 10;
|
||||
Settings.TurboSkipFrames = 19;
|
||||
Settings.DisplayFrameRate = false;
|
||||
// Settings.AutoDisplayMessages = 1; /*** eke-eke snes9x 1.51 ***/
|
||||
|
||||
/* Eke-Eke: frame timings in 50hz and 60hz cpu mode */
|
||||
Settings.FrameTimePAL = 20000;
|
||||
Settings.FrameTimeNTSC = 16667;
|
||||
|
||||
/*** SDD1 - Star Ocean Returns -;) ***/
|
||||
Settings.SDD1Pack = true;
|
||||
|
||||
GCSettings.AutoLoad = 0;
|
||||
GCSettings.AutoSave = 0;
|
||||
|
||||
strncpy (GCSettings.gcip, GC_IP, 15);
|
||||
strncpy (GCSettings.gwip, GW_IP, 15);
|
||||
strncpy (GCSettings.mask, MASK, 15);
|
||||
strncpy (GCSettings.smbip, SMB_IP, 15);
|
||||
strncpy (GCSettings.smbuser, SMB_USER, 19);
|
||||
strncpy (GCSettings.smbpwd, SMB_PWD, 19);
|
||||
strncpy (GCSettings.smbgcid, SMB_GCID, 19);
|
||||
strncpy (GCSettings.smbsvid, SMB_SVID, 19);
|
||||
strncpy (GCSettings.smbshare, SMB_SHARE, 19);
|
||||
|
||||
GCSettings.NGCZoom = 0;
|
||||
GCSettings.VerifySaves = 0;
|
||||
|
||||
Settings.ForceNTSC = 0;
|
||||
Settings.ForcePAL = 0;
|
||||
Settings.ForceHiROM = 0;
|
||||
Settings.ForceLoROM = 0;
|
||||
Settings.ForceHeader = 0;
|
||||
Settings.ForceNoHeader = 0;
|
||||
Settings.ForceTransparency = 0;
|
||||
Settings.ForceInterleaved = 0;
|
||||
Settings.ForceInterleaved2 = 0;
|
||||
Settings.ForceInterleaveGD24 = 0;
|
||||
Settings.ForceNotInterleaved = 0;
|
||||
Settings.ForceNoSuperFX = 0;
|
||||
Settings.ForceSuperFX = 0;
|
||||
Settings.ForceDSP1 = 0;
|
||||
Settings.ForceNoDSP1 = 0;
|
||||
|
||||
}
|
||||
|
162
source/ngc/s9xconfig.h
Normal file
162
source/ngc/s9xconfig.h
Normal file
@ -0,0 +1,162 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
*
|
||||
* s9xconfig.h
|
||||
*
|
||||
* Configuration parameters have been moved here for easier maintenance.
|
||||
* Refer to Snes9x.h for all combinations.
|
||||
* The defaults used here are taken directly from porting.html
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
*****************************************************************************/
|
||||
#ifndef _S9XCONFIG_
|
||||
|
||||
#define _S9XCONFIG_
|
||||
|
||||
void DefaultSettings ();
|
||||
|
||||
#endif
|
433
source/ngc/s9xsupport.cpp
Normal file
433
source/ngc/s9xsupport.cpp
Normal file
@ -0,0 +1,433 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
*
|
||||
* s9xsupport.cpp
|
||||
*
|
||||
* This file contains the supporting functions defined in porting.html, with
|
||||
* others taken from unix/x11.cpp and unix/unix.cpp
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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 <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "debug.h"
|
||||
#include "cpuexec.h"
|
||||
#include "ppu.h"
|
||||
#include "apu.h"
|
||||
#include "display.h"
|
||||
#include "gfx.h"
|
||||
#include "soundux.h"
|
||||
#include "spc700.h"
|
||||
#include "spc7110.h"
|
||||
#include "controls.h"
|
||||
#include "gctime.h"
|
||||
#include "snes9xGx.h"
|
||||
|
||||
|
||||
#include "video.h"
|
||||
#include "audio.h"
|
||||
|
||||
extern u32 FrameTimer;
|
||||
|
||||
tb_t prev;
|
||||
tb_t now;
|
||||
|
||||
|
||||
/*** Miscellaneous Functions ***/
|
||||
void
|
||||
S9xMessage (int /*type */ , int /*number */ , const char *message)
|
||||
{
|
||||
#define MAX_MESSAGE_LEN (36 * 3)
|
||||
|
||||
static char buffer[MAX_MESSAGE_LEN + 1];
|
||||
strncpy (buffer, message, MAX_MESSAGE_LEN);
|
||||
buffer[MAX_MESSAGE_LEN] = 0;
|
||||
S9xSetInfoString (buffer);
|
||||
}
|
||||
|
||||
void
|
||||
S9xExit ()
|
||||
{
|
||||
/*** Nintendo Gamecube will NEVER get here ... unless
|
||||
something major went wrong !!
|
||||
|
||||
In which case, I'll settle for a reboot first -;)
|
||||
***/
|
||||
}
|
||||
|
||||
/*** File based functions ***/
|
||||
const char *
|
||||
S9xChooseFilename (bool8 read_only)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
S9xChooseMovieFilename (bool8 read_only)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
S9xGetDirectory (enum s9x_getdirtype dirtype)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
S9xGetFilename (const char *ex, enum s9x_getdirtype dirtype)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
S9xGetFilenameInc (const char *e, enum s9x_getdirtype dirtype)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*** Memory based functions ***/
|
||||
void
|
||||
S9xAutoSaveSRAM ()
|
||||
{
|
||||
//Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR));
|
||||
}
|
||||
|
||||
/*** Sound based functions ***/
|
||||
void
|
||||
S9xToggleSoundChannel (int c)
|
||||
{
|
||||
if (c == 8)
|
||||
so.sound_switch = 255;
|
||||
else
|
||||
so.sound_switch ^= 1 << c;
|
||||
S9xSetSoundControl (so.sound_switch);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* OpenSoundDevice
|
||||
*
|
||||
* Main initialisation for NGC sound system
|
||||
****************************************************************************/
|
||||
bool8
|
||||
S9xOpenSoundDevice (int mode, bool8 stereo, int buffer_size)
|
||||
{
|
||||
so.stereo = TRUE;
|
||||
so.playback_rate = 32000;
|
||||
so.sixteen_bit = TRUE;
|
||||
so.encoded = 0;
|
||||
so.buffer_size = 4096;
|
||||
so.sound_switch = 255;
|
||||
S9xSetPlaybackRate (so.playback_rate);
|
||||
|
||||
InitGCAudio ();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*** Deprecated function. NGC uses threaded sound ***/
|
||||
void
|
||||
S9xGenerateSound ()
|
||||
{
|
||||
}
|
||||
|
||||
/* eke-eke */
|
||||
void S9xInitSync()
|
||||
{
|
||||
FrameTimer = 0;
|
||||
mftb(&prev);
|
||||
}
|
||||
|
||||
/*** Synchronisation ***/
|
||||
void
|
||||
S9xSyncSpeed ()
|
||||
{
|
||||
uint32 skipFrms = Settings.SkipFrames;
|
||||
|
||||
if ( Settings.TurboMode )
|
||||
skipFrms = Settings.TurboSkipFrames;
|
||||
|
||||
if ( !Settings.PAL ) /* use NGC vertical sync (VSYNC) with NTSC roms */
|
||||
{
|
||||
while (FrameTimer == 0)
|
||||
{
|
||||
usleep (50);
|
||||
}
|
||||
|
||||
if (FrameTimer > skipFrms)
|
||||
FrameTimer = skipFrms;
|
||||
|
||||
if ((FrameTimer > 1) && (IPPU.SkippedFrames < skipFrms))
|
||||
{
|
||||
IPPU.SkippedFrames++;
|
||||
IPPU.RenderThisFrame = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPPU.SkippedFrames = 0;
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
}
|
||||
}
|
||||
else /* use internal timer for PAL roms */
|
||||
{
|
||||
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
|
||||
|
||||
mftb(&now);
|
||||
|
||||
if (tb_diff_usec(&now, &prev) > timediffallowed)
|
||||
{
|
||||
/*while ( tb_diff_usec(&now, &prev) < timediffallowed * 2) {
|
||||
mftb(&now);
|
||||
}*/
|
||||
|
||||
/* Timer has already expired */
|
||||
if (IPPU.SkippedFrames < skipFrms)
|
||||
{
|
||||
IPPU.SkippedFrames++;
|
||||
IPPU.RenderThisFrame = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
IPPU.SkippedFrames = 0;
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*** Ahead - so hold up ***/
|
||||
while (tb_diff_usec(&now, &prev) < timediffallowed) mftb(&now);
|
||||
IPPU.RenderThisFrame = TRUE;
|
||||
IPPU.SkippedFrames = 0;
|
||||
}
|
||||
|
||||
memcpy(&prev, &now, sizeof(tb_t));
|
||||
}
|
||||
|
||||
if ( !Settings.TurboMode )
|
||||
FrameTimer--;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/*** Video / Display related functions ***/
|
||||
bool8
|
||||
S9xInitUpdate ()
|
||||
{
|
||||
/***
|
||||
* Is this necessary in 1.50 ?
|
||||
* memset (GFX.Screen, 0, IMAGE_WIDTH * IMAGE_HEIGHT * 2);
|
||||
*/
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
bool8
|
||||
S9xDeinitUpdate (int Width, int Height)
|
||||
{
|
||||
update_video (Width, Height);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
bool8
|
||||
S9xContinueUpdate (int Width, int Height)
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
S9xSetPalette ()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*** Input functions ***/
|
||||
void
|
||||
S9xHandlePortCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool
|
||||
S9xPollButton (uint32 id, bool * pressed)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
S9xPollAxis (uint32 id, int16 * value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
S9xPollPointer (uint32 id, int16 * x, int16 * y)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
S9xLoadSDD1Data ()
|
||||
{
|
||||
|
||||
Memory.FreeSDD1Data ();
|
||||
|
||||
Settings.SDD1Pack = FALSE;
|
||||
|
||||
if (strncmp (Memory.ROMName, "Star Ocean", 10) == 0)
|
||||
Settings.SDD1Pack = TRUE;
|
||||
|
||||
if (strncmp (Memory.ROMName, "STREET FIGHTER ALPHA2", 21) == 0)
|
||||
Settings.SDD1Pack = TRUE;
|
||||
|
||||
return;
|
||||
|
||||
}
|
447
source/ngc/sdload.cpp
Normal file
447
source/ngc/sdload.cpp
Normal file
@ -0,0 +1,447 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
*
|
||||
* sdload.cpp
|
||||
*
|
||||
* Load ROMS from SD Card
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ogcsys.h>
|
||||
#include "sdcard.h"
|
||||
#include "ngcunzip.h"
|
||||
#include "memmap.h"
|
||||
#include "video.h"
|
||||
#include "ftfont.h"
|
||||
#include "dvd.h"
|
||||
#include "filesel.h"
|
||||
#include "sram.h"
|
||||
#include "preferences.h"
|
||||
|
||||
#include <zlib.h>
|
||||
extern unsigned char savebuffer[];
|
||||
extern char output[16384];
|
||||
char rootSDdir[SDCARD_MAX_PATH_LEN];
|
||||
extern int offset;
|
||||
extern int selection;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Update SDCARD curent directory name
|
||||
***************************************************************************/
|
||||
int updateSDdirname()
|
||||
{
|
||||
int size=0;
|
||||
char *test;
|
||||
char temp[1024];
|
||||
|
||||
/* current directory doesn't change */
|
||||
if (strcmp(filelist[selection].filename,".") == 0) return 0;
|
||||
|
||||
/* go up to parent directory */
|
||||
else if (strcmp(filelist[selection].filename,"..") == 0)
|
||||
{
|
||||
/* determine last subdirectory namelength */
|
||||
sprintf(temp,"%s",rootSDdir);
|
||||
test= strtok(temp,"\\");
|
||||
while (test != NULL)
|
||||
{
|
||||
size = strlen(test);
|
||||
test = strtok(NULL,"\\");
|
||||
}
|
||||
|
||||
/* remove last subdirectory name */
|
||||
size = strlen(rootSDdir) - size - 1;
|
||||
rootSDdir[size] = 0;
|
||||
|
||||
/* handles root name */
|
||||
if (strcmp(rootSDdir,"dev0:") == 0)
|
||||
{
|
||||
sprintf(rootSDdir,"dev0:\\SNESROMS");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* test new directory namelength */
|
||||
if ((strlen(rootSDdir)+1+strlen(filelist[selection].filename)) < SDCARD_MAX_PATH_LEN)
|
||||
{
|
||||
/* handles root name */
|
||||
if (strcmp(rootSDdir,"dev0:\\SNESROMS\\..") == 0) sprintf(rootSDdir,"dev0:");
|
||||
|
||||
/* update current directory name */
|
||||
sprintf(rootSDdir, "%s\\%s",rootSDdir, filelist[selection].filename);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt ("Dirname is too long !");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Browse SDCARD subdirectories
|
||||
***************************************************************************/
|
||||
int parseSDdirectory()
|
||||
{
|
||||
int entries = 0;
|
||||
int nbfiles = 0;
|
||||
DIR *sddir = NULL;
|
||||
char tname[1024];
|
||||
|
||||
offset = selection = 0;
|
||||
|
||||
/* Get a list of files from the actual root directory */
|
||||
entries = SDCARD_ReadDir (rootSDdir, &sddir);
|
||||
|
||||
if (entries < 0) entries = 0;
|
||||
if (entries > MAXFILES) entries = MAXFILES;
|
||||
|
||||
/* Move to DVD structure - this is required for the file selector */
|
||||
while (entries)
|
||||
{
|
||||
memcpy (tname, &sddir[nbfiles].fname, 1024);
|
||||
memset (&filelist[nbfiles], 0, sizeof (FILEENTRIES));
|
||||
strncpy(filelist[nbfiles].filename,tname,MAXJOLIET+1);
|
||||
filelist[nbfiles].filename[MAXJOLIET] = 0;
|
||||
strncpy(filelist[nbfiles].displayname,tname,MAXDISPLAY+1);
|
||||
filelist[nbfiles].filename[MAXDISPLAY] = 0;
|
||||
filelist[nbfiles].length = sddir[nbfiles].fsize;
|
||||
filelist[nbfiles].flags = (char)(sddir[nbfiles].fattr & SDCARD_ATTR_DIR);
|
||||
nbfiles++;
|
||||
entries--;
|
||||
}
|
||||
|
||||
/*** Release memory ***/
|
||||
free(sddir);
|
||||
|
||||
return nbfiles;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* LoadSDFile
|
||||
****************************************************************************/
|
||||
extern int haveSDdir;
|
||||
int
|
||||
LoadSDFile (char *filename, int length)
|
||||
{
|
||||
char zipbuffer[2048];
|
||||
char filepath[SDCARD_MAX_PATH_LEN];
|
||||
sd_file *handle;
|
||||
char *rbuffer;
|
||||
PKZIPHEADER pkzip;
|
||||
z_stream zs;
|
||||
int res, outbytes = 0;
|
||||
int size;
|
||||
int have;
|
||||
|
||||
rbuffer = (char *) Memory.ROM;
|
||||
|
||||
/* Check filename length */
|
||||
if ((strlen(rootSDdir)+1+strlen(filelist[selection].filename)) < SDCARD_MAX_PATH_LEN)
|
||||
sprintf(filepath, "%s\\%s",rootSDdir,filelist[selection].filename);
|
||||
else
|
||||
{
|
||||
WaitPrompt ("Maximum Filename Length reached !");
|
||||
haveSDdir = 0; // reset everything before next access
|
||||
return -1;
|
||||
}
|
||||
|
||||
handle = SDCARD_OpenFile (filepath, "rb");
|
||||
if (handle > 0)
|
||||
{
|
||||
SDCARD_ReadFile (handle, zipbuffer, 2048);
|
||||
|
||||
if (IsZipFile (zipbuffer))
|
||||
{
|
||||
/*** Unzip the ROM ***/
|
||||
memcpy (&pkzip, zipbuffer, sizeof (PKZIPHEADER));
|
||||
pkzip.uncompressedSize = FLIP32 (pkzip.uncompressedSize);
|
||||
memset (&zs, 0, sizeof (zs));
|
||||
zs.zalloc = Z_NULL;
|
||||
zs.zfree = Z_NULL;
|
||||
zs.opaque = Z_NULL;
|
||||
zs.avail_in = 0;
|
||||
zs.next_in = Z_NULL;
|
||||
|
||||
res = inflateInit2 (&zs, -MAX_WBITS);
|
||||
|
||||
if (res != Z_OK)
|
||||
{
|
||||
SDCARD_CloseFile (handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = (sizeof (PKZIPHEADER) +
|
||||
FLIP16 (pkzip.filenameLength) +
|
||||
FLIP16 (pkzip.extraDataLength));
|
||||
|
||||
do
|
||||
{
|
||||
zs.avail_in = 2048 - size;
|
||||
zs.next_in = (Bytef *) zipbuffer + size;
|
||||
|
||||
do
|
||||
{
|
||||
zs.avail_out = 16384;
|
||||
zs.next_out = (Bytef *) output;
|
||||
|
||||
res = inflate (&zs, Z_NO_FLUSH);
|
||||
|
||||
have = 16384 - zs.avail_out;
|
||||
|
||||
if (have)
|
||||
{
|
||||
memcpy (rbuffer + outbytes, output, have);
|
||||
outbytes += have;
|
||||
}
|
||||
|
||||
}
|
||||
while (zs.avail_out == 0);
|
||||
|
||||
sprintf (filepath, "Read %d bytes of %d", outbytes,
|
||||
pkzip.uncompressedSize);
|
||||
//ShowAction (filepath);
|
||||
ShowProgress (filepath, outbytes, pkzip.uncompressedSize);
|
||||
|
||||
size = 0;
|
||||
SDCARD_ReadFile (handle, zipbuffer, 2048);
|
||||
|
||||
}
|
||||
while (res != Z_STREAM_END
|
||||
&& (u32) outbytes < pkzip.uncompressedSize);
|
||||
|
||||
inflateEnd (&zs);
|
||||
|
||||
SDCARD_CloseFile (handle);
|
||||
return pkzip.uncompressedSize;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*** Just load the file up ***/
|
||||
length = SDCARD_GetFileSize (handle);
|
||||
sprintf (filepath, "Loading %d bytes", length);
|
||||
ShowAction (filepath);
|
||||
memcpy (rbuffer, zipbuffer, 2048);
|
||||
SDCARD_ReadFile (handle, rbuffer + 2048, length - 2048);
|
||||
SDCARD_CloseFile (handle);
|
||||
return length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt ("Error opening file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Load savebuffer from SD card file
|
||||
****************************************************************************/
|
||||
int
|
||||
LoadBufferFromSD (char *filepath, bool8 silent)
|
||||
{
|
||||
sd_file *handle;
|
||||
int offset = 0;
|
||||
int read = 0;
|
||||
|
||||
SDCARD_Init ();
|
||||
|
||||
handle = SDCARD_OpenFile (filepath, "rb");
|
||||
|
||||
if (handle <= 0)
|
||||
{
|
||||
if ( !silent )
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "Couldn't open %s", filepath);
|
||||
WaitPrompt (msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset (savebuffer, 0, 0x22000);
|
||||
|
||||
/*** This is really nice, just load the file and decode it ***/
|
||||
while ((read = SDCARD_ReadFile (handle, savebuffer + offset, 1024)) > 0)
|
||||
{
|
||||
offset += read;
|
||||
}
|
||||
|
||||
SDCARD_CloseFile (handle);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Write savebuffer to SD card file
|
||||
****************************************************************************/
|
||||
int
|
||||
SaveBufferToSD (char *filepath, int datasize, bool8 silent)
|
||||
{
|
||||
sd_file *handle;
|
||||
|
||||
SDCARD_Init ();
|
||||
|
||||
if (datasize)
|
||||
{
|
||||
handle = SDCARD_OpenFile (filepath, "wb");
|
||||
|
||||
if (handle <= 0)
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "Couldn't save %s", filepath);
|
||||
WaitPrompt (msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDCARD_WriteFile (handle, savebuffer, datasize);
|
||||
SDCARD_CloseFile (handle);
|
||||
}
|
||||
|
||||
return datasize;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Save SRAM to SD Card
|
||||
****************************************************************************/
|
||||
void
|
||||
SaveSRAMToSD (uint8 slot, bool8 silent)
|
||||
{
|
||||
char filepath[1024];
|
||||
int datasize;
|
||||
int offset;
|
||||
|
||||
ShowAction ("Saving SRAM to SD...");
|
||||
|
||||
#ifdef SDUSE_LFN
|
||||
sprintf (filepath, "dev%d:\\%s\\%s.srm", slot, SNESSAVEDIR, Memory.ROMName);
|
||||
#else
|
||||
sprintf (filepath, "dev%d:\\SNESSAVE\\%08x.srm", slot, Memory.ROMCRC32);
|
||||
#endif
|
||||
|
||||
datasize = prepareEXPORTsavedata ();
|
||||
|
||||
if ( datasize )
|
||||
{
|
||||
offset = SaveBufferToSD (filepath, datasize, silent);
|
||||
|
||||
if ( (offset > 0) && (!silent) )
|
||||
{
|
||||
sprintf (filepath, "Wrote %d bytes", offset);
|
||||
WaitPrompt (filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Load SRAM From SD Card
|
||||
****************************************************************************/
|
||||
void
|
||||
LoadSRAMFromSD (uint8 slot, bool8 silent)
|
||||
{
|
||||
char filepath[1024];
|
||||
int offset = 0;
|
||||
|
||||
ShowAction ("Loading SRAM from SD...");
|
||||
|
||||
#ifdef SDUSE_LFN
|
||||
sprintf (filepath, "dev%d:\\%s\\%s.srm", slot, SNESSAVEDIR, Memory.ROMName);
|
||||
// sprintf (filepath, "dev%d:\\%s.srm", Memory.ROMName);
|
||||
#else
|
||||
sprintf (filepath, "dev%d:\\SNESSAVE\\%08x.srm", slot, Memory.ROMCRC32);
|
||||
// sprintf (filepath, "dev0:\\%08x.srm", Memory.ROMCRC32);
|
||||
#endif
|
||||
|
||||
offset = LoadBufferFromSD (filepath, silent);
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
decodesavedata (offset);
|
||||
if ( !silent )
|
||||
{
|
||||
sprintf (filepath, "Loaded %d bytes", offset);
|
||||
WaitPrompt(filepath);
|
||||
}
|
||||
S9xSoftReset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Save Preferences to SD Card
|
||||
****************************************************************************/
|
||||
void
|
||||
SavePrefsToSD (uint8 slot, bool8 silent)
|
||||
{
|
||||
char filepath[1024];
|
||||
int datasize;
|
||||
int offset;
|
||||
|
||||
ShowAction ("Saving prefs to SD...");
|
||||
|
||||
#ifdef SDUSE_LFN
|
||||
sprintf (filepath, "dev%d:\\%s\\%s", slot, SNESSAVEDIR, PREFS_FILE_NAME);
|
||||
#else
|
||||
sprintf (filepath, "dev%d:\\SNESSAVE\\%s", slot, PREFS_FILE_NAME);
|
||||
#endif
|
||||
|
||||
datasize = preparePrefsData ();
|
||||
offset = SaveBufferToSD (filepath, datasize, silent);
|
||||
|
||||
if ( (offset > 0) && (!silent) )
|
||||
{
|
||||
sprintf (filepath, "Wrote %d bytes", offset);
|
||||
WaitPrompt (filepath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Load Preferences from SD Card
|
||||
****************************************************************************/
|
||||
void
|
||||
LoadPrefsFromSD (uint8 slot, bool8 silent)
|
||||
{
|
||||
char filepath[1024];
|
||||
int offset = 0;
|
||||
|
||||
ShowAction ("Loading prefs from SD...");
|
||||
|
||||
#ifdef SDUSE_LFN
|
||||
sprintf (filepath, "dev%d:\\%s\\%s", slot, SNESSAVEDIR, PREFS_FILE_NAME);
|
||||
// sprintf (filepath, "dev%d:\\%s.srm", Memory.ROMName);
|
||||
#else
|
||||
sprintf (filepath, "dev%d:\\SNESSAVE\\%s", slot, PREFS_FILE_NAME);
|
||||
// sprintf (filepath, "dev0:\\%08x.srm", Memory.ROMCRC32);
|
||||
#endif
|
||||
|
||||
offset = LoadBufferFromSD (filepath, silent);
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
decodePrefsData ();
|
||||
if ( !silent )
|
||||
{
|
||||
sprintf (filepath, "Loaded %d bytes", offset);
|
||||
WaitPrompt(filepath);
|
||||
}
|
||||
}
|
||||
}
|
27
source/ngc/sdload.h
Normal file
27
source/ngc/sdload.h
Normal file
@ -0,0 +1,27 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
*
|
||||
* sdload.cpp
|
||||
*
|
||||
* Load ROMS from SD Card
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _LOADFROMSDC_
|
||||
#define _LOADFROMSDC_
|
||||
#include <sdcard.h>
|
||||
|
||||
int updateSDdirname();
|
||||
int parseSDdirectory();
|
||||
int LoadSDFile (char *filename, int length);
|
||||
void SaveSRAMToSD (uint8 slot, bool8 silent);
|
||||
void LoadSRAMFromSD (uint8 slot, bool8 silent);
|
||||
void SavePrefsToSD (uint8 slot, bool8 silent);
|
||||
void LoadPrefsFromSD (uint8 slot, bool8 silent);
|
||||
|
||||
extern char rootSDdir[SDCARD_MAX_PATH_LEN];
|
||||
|
||||
#endif
|
478
source/ngc/smbload.cpp
Normal file
478
source/ngc/smbload.cpp
Normal file
@ -0,0 +1,478 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
*
|
||||
* smbload.cpp
|
||||
*
|
||||
* Load ROMS from a Network share.
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ogcsys.h>
|
||||
#include <network.h>
|
||||
extern "C"
|
||||
{
|
||||
#include "smb.h"
|
||||
}
|
||||
#include "ngcunzip.h"
|
||||
#include "memmap.h"
|
||||
#include "video.h"
|
||||
#include "ftfont.h"
|
||||
#include "dvd.h"
|
||||
#include "filesel.h"
|
||||
#include "sram.h"
|
||||
#include "preferences.h"
|
||||
#include "smbload.h"
|
||||
#include "Snes9xGx.h"
|
||||
#include <zlib.h>
|
||||
|
||||
static int connected = 0;
|
||||
static int netinited = 0;
|
||||
|
||||
char output[16384];
|
||||
unsigned int SMBTimer = 0;
|
||||
extern unsigned char savebuffer[];
|
||||
|
||||
#define ZIPCHUNK 16384
|
||||
#define SMBTIMEOUT ( 3600 ) /*** Some implementations timeout in 10 minutes ***/
|
||||
SMBINFO smbinfo =
|
||||
{ GC_IP, GW_IP, MASK, SMB_IP,
|
||||
SMB_USER, SMB_PWD, SMB_GCID, SMB_SVID, SMB_SHARE
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Mount SMB Share
|
||||
****************************************************************************/
|
||||
void
|
||||
ConnectSMB ()
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (SMBTimer > SMBTIMEOUT)
|
||||
{
|
||||
connected = 0;
|
||||
SMBTimer = 0;
|
||||
}
|
||||
|
||||
if (connected == 0)
|
||||
{
|
||||
|
||||
if (netinited == 0)
|
||||
{
|
||||
ShowAction ("Setting up network interface ...");
|
||||
ret = if_config (smbinfo.gcip, smbinfo.gwip, smbinfo.mask, 0);
|
||||
netinited = 1;
|
||||
}
|
||||
|
||||
ShowAction ("Connecting to share ...");
|
||||
SMB_Destroy ();
|
||||
|
||||
if (SMB_Init (smbinfo.smbuser, smbinfo.smbpwd,
|
||||
smbinfo.smbgcid, smbinfo.smbsvid, smbinfo.smbshare,
|
||||
smbinfo.smbip) != SMB_SUCCESS)
|
||||
{
|
||||
WaitPrompt ("Failed to connect to SMB share");
|
||||
connected = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
connected = 1;
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* parseSMBDirectory
|
||||
*
|
||||
* Load the share directory and put in the filelist array
|
||||
*****************************************************************************/
|
||||
int
|
||||
parseSMBDirectory ()
|
||||
{
|
||||
char searchpath[1024];
|
||||
int filecount = 0;
|
||||
SMBDIRENTRY smbdir;
|
||||
|
||||
ConnectSMB ();
|
||||
|
||||
strcpy (searchpath, SNESROMDIR);
|
||||
strcat (searchpath, "\\*.*");
|
||||
|
||||
if (SMB_FindFirst
|
||||
(searchpath, SMB_SRCH_READONLY | SMB_SRCH_SYSTEM | SMB_SRCH_HIDDEN,
|
||||
&smbdir) != SMB_SUCCESS)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
memset (&filelist[filecount], 0, sizeof (FILEENTRIES));
|
||||
filelist[filecount].length = smbdir.size_low;
|
||||
smbdir.name[MAXJOLIET] = 0;
|
||||
|
||||
/*** Update display name ***/
|
||||
memcpy (&filelist[filecount].displayname, smbdir.name, MAXDISPLAY);
|
||||
filelist[filecount].displayname[MAXDISPLAY] = 0;
|
||||
|
||||
strcpy (filelist[filecount].filename, smbdir.name);
|
||||
filecount++;
|
||||
|
||||
}
|
||||
while (SMB_FindNext (&smbdir) == SMB_SUCCESS);
|
||||
|
||||
SMB_FindClose ();
|
||||
|
||||
return filecount;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Load SMB file
|
||||
****************************************************************************/
|
||||
int
|
||||
LoadSMBFile (char *filename, int length)
|
||||
{
|
||||
char buffer[128];
|
||||
int offset = 0;
|
||||
int bytesread = 0;
|
||||
int total = 0;
|
||||
char filepath[1024];
|
||||
SMBFILE smbfile;
|
||||
char *rbuffer;
|
||||
char zipbuffer[16384];
|
||||
int pass = 0;
|
||||
int zip = 0;
|
||||
PKZIPHEADER pkzip;
|
||||
z_stream zs;
|
||||
int res, outbytes;
|
||||
|
||||
strcpy (filepath, SNESROMDIR);
|
||||
strcat (filepath, "\\");
|
||||
strcat (filepath, filename);
|
||||
rbuffer = (char *) Memory.ROM;
|
||||
outbytes = 0;
|
||||
int have = 0;
|
||||
|
||||
ConnectSMB ();
|
||||
|
||||
if ( connected )
|
||||
{
|
||||
|
||||
/*** Open the file for reading ***/
|
||||
smbfile =
|
||||
SMB_Open (filepath, SMB_OPEN_READING | SMB_DENY_NONE, SMB_OF_OPEN);
|
||||
if (smbfile)
|
||||
{
|
||||
while (total < length)
|
||||
{
|
||||
bytesread = SMB_Read (zipbuffer, 16384, offset, smbfile);
|
||||
|
||||
if (pass == 0)
|
||||
{
|
||||
/*** Is this a Zip file ? ***/
|
||||
zip = IsZipFile (zipbuffer);
|
||||
if (zip)
|
||||
{
|
||||
memcpy (&pkzip, zipbuffer, sizeof (PKZIPHEADER));
|
||||
pkzip.uncompressedSize = FLIP32 (pkzip.uncompressedSize);
|
||||
memset (&zs, 0, sizeof (zs));
|
||||
zs.zalloc = Z_NULL;
|
||||
zs.zfree = Z_NULL;
|
||||
zs.opaque = Z_NULL;
|
||||
zs.avail_in = 0;
|
||||
zs.next_in = Z_NULL;
|
||||
res = inflateInit2 (&zs, -MAX_WBITS);
|
||||
|
||||
if (res != Z_OK)
|
||||
{
|
||||
SMB_Close (smbfile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
zs.avail_in =
|
||||
16384 - (sizeof (PKZIPHEADER) +
|
||||
FLIP16 (pkzip.filenameLength) +
|
||||
FLIP16 (pkzip.extraDataLength));
|
||||
zs.next_in =
|
||||
(Bytef *) zipbuffer + (sizeof (PKZIPHEADER) +
|
||||
FLIP16 (pkzip.filenameLength) +
|
||||
FLIP16 (pkzip.extraDataLength));
|
||||
}
|
||||
}
|
||||
|
||||
if (zip)
|
||||
{
|
||||
if (pass)
|
||||
{
|
||||
zs.avail_in = bytesread;
|
||||
zs.next_in = (Bytef *) zipbuffer;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
zs.avail_out = ZIPCHUNK;
|
||||
zs.next_out = (Bytef *) output;
|
||||
|
||||
res = inflate (&zs, Z_NO_FLUSH);
|
||||
|
||||
have = ZIPCHUNK - zs.avail_out;
|
||||
|
||||
if (have)
|
||||
{
|
||||
memcpy (rbuffer + outbytes, output, have);
|
||||
outbytes += have;
|
||||
}
|
||||
}
|
||||
while (zs.avail_out == 0);
|
||||
}
|
||||
else
|
||||
memcpy (rbuffer + offset, zipbuffer, bytesread);
|
||||
|
||||
total += bytesread;
|
||||
offset += bytesread;
|
||||
|
||||
if (!zip)
|
||||
{
|
||||
sprintf (buffer, "Read %d of %d bytes", total, length);
|
||||
ShowProgress (buffer, total, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (buffer, "Unzipped %d of %d", outbytes,
|
||||
pkzip.uncompressedSize);
|
||||
ShowProgress (buffer, outbytes, pkzip.uncompressedSize);
|
||||
}
|
||||
//ShowAction (buffer);
|
||||
|
||||
pass++;
|
||||
|
||||
}
|
||||
|
||||
if (zip)
|
||||
{
|
||||
inflateEnd (&zs);
|
||||
total = outbytes;
|
||||
}
|
||||
|
||||
SMB_Close (smbfile);
|
||||
|
||||
return total;
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt ("SMB Reading Failed!");
|
||||
//while (1);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Write savebuffer to SMB file
|
||||
****************************************************************************/
|
||||
int
|
||||
SaveBufferToSMB (char *filepath, int datasize, bool8 silent)
|
||||
{
|
||||
SMBFILE smbfile;
|
||||
int dsize = datasize;
|
||||
int wrote = 0;
|
||||
int offset = 0;
|
||||
|
||||
ConnectSMB ();
|
||||
|
||||
if ( connected )
|
||||
{
|
||||
smbfile =
|
||||
SMB_Open (filepath, SMB_OPEN_WRITING | SMB_DENY_NONE,
|
||||
SMB_OF_CREATE | SMB_OF_TRUNCATE);
|
||||
|
||||
if (smbfile)
|
||||
{
|
||||
while (dsize > 0)
|
||||
{
|
||||
if (dsize > 1024)
|
||||
wrote =
|
||||
SMB_Write ((char *) savebuffer + offset, 1024, offset, smbfile);
|
||||
else
|
||||
wrote =
|
||||
SMB_Write ((char *) savebuffer + offset, dsize, offset, smbfile);
|
||||
|
||||
offset += wrote;
|
||||
dsize -= wrote;
|
||||
}
|
||||
|
||||
SMB_Close (smbfile);
|
||||
SMBTimer = 0;
|
||||
|
||||
return offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "Couldn't save SMB:%s", filepath);
|
||||
WaitPrompt (msg);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Load savebuffer from SMB file
|
||||
****************************************************************************/
|
||||
int
|
||||
LoadBufferFromSMB (char *filepath, bool8 silent)
|
||||
{
|
||||
SMBFILE smbfile;
|
||||
int ret;
|
||||
int offset = 0;
|
||||
|
||||
ConnectSMB ();
|
||||
|
||||
if ( connected )
|
||||
{
|
||||
smbfile =
|
||||
SMB_Open (filepath, SMB_OPEN_READING | SMB_DENY_NONE, SMB_OF_OPEN);
|
||||
|
||||
if (!smbfile)
|
||||
{
|
||||
if (!silent)
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "Couldn't open SMB:%s", filepath);
|
||||
WaitPrompt (msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset (savebuffer, 0, 0x22000);
|
||||
|
||||
while ((ret =
|
||||
SMB_Read ((char *) savebuffer + offset, 1024, offset,
|
||||
smbfile)) > 0)
|
||||
offset += ret;
|
||||
|
||||
SMB_Close (smbfile);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Save SRAM to SMB
|
||||
****************************************************************************/
|
||||
void
|
||||
SaveSRAMToSMB (bool8 silent)
|
||||
{
|
||||
char filepath[1024];
|
||||
int datasize;
|
||||
int offset;
|
||||
|
||||
sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMName);
|
||||
ShowAction ("Saving SRAM to SMB...");
|
||||
|
||||
datasize = prepareEXPORTsavedata ();
|
||||
|
||||
if ( datasize )
|
||||
{
|
||||
offset = SaveBufferToSMB (filepath, datasize, silent);
|
||||
|
||||
if ( (offset > 0) && (!silent) )
|
||||
{
|
||||
sprintf (filepath, "Wrote %d bytes", offset);
|
||||
WaitPrompt (filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Load SRAM from SMB
|
||||
****************************************************************************/
|
||||
void
|
||||
LoadSRAMFromSMB (bool8 silent)
|
||||
{
|
||||
char filepath[1024];
|
||||
int offset;
|
||||
|
||||
sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMName);
|
||||
ShowAction ("Loading SRAM from SMB...");
|
||||
|
||||
offset = LoadBufferFromSMB (filepath, silent);
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
decodesavedata (offset);
|
||||
if ( !silent )
|
||||
{
|
||||
sprintf (filepath, "Loaded %d bytes", offset);
|
||||
WaitPrompt(filepath);
|
||||
}
|
||||
S9xSoftReset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Save Preferences to SMB
|
||||
****************************************************************************/
|
||||
void
|
||||
SavePrefsToSMB (bool8 silent)
|
||||
{
|
||||
char filepath[1024];
|
||||
int datasize;
|
||||
int offset;
|
||||
|
||||
sprintf (filepath, "%s\\%s", SNESSAVEDIR, PREFS_FILE_NAME);
|
||||
ShowAction ("Saving preferences to SMB...");
|
||||
|
||||
datasize = preparePrefsData ();
|
||||
|
||||
if ( datasize )
|
||||
{
|
||||
offset = SaveBufferToSMB (filepath, datasize, silent);
|
||||
|
||||
if ( (offset > 0) && (!silent) )
|
||||
{
|
||||
sprintf (filepath, "Wrote %d bytes", offset);
|
||||
WaitPrompt (filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Load Preferences from SMB
|
||||
****************************************************************************/
|
||||
void
|
||||
LoadPrefsFromSMB (bool8 silent)
|
||||
{
|
||||
char filepath[1024];
|
||||
int offset;
|
||||
|
||||
ShowAction ("Loading preferences from SMB...");
|
||||
|
||||
sprintf (filepath, "%s\\%s", SNESSAVEDIR, PREFS_FILE_NAME);
|
||||
|
||||
offset = LoadBufferFromSMB (filepath, silent);
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
decodePrefsData ();
|
||||
if ( !silent )
|
||||
{
|
||||
sprintf (filepath, "Loaded %d bytes", offset);
|
||||
WaitPrompt(filepath);
|
||||
}
|
||||
}
|
||||
}
|
40
source/ngc/smbload.h
Normal file
40
source/ngc/smbload.h
Normal file
@ -0,0 +1,40 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
*
|
||||
* smbload.cpp
|
||||
*
|
||||
* Load ROMS from a Network share.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _NGCSMB_
|
||||
|
||||
#define _NGCSMB_
|
||||
|
||||
void ConnectSMB ();
|
||||
int parseSMBDirectory ();
|
||||
int LoadSMBFile (char *filename, int length);
|
||||
void SaveSRAMToSMB (bool8 silent);
|
||||
void LoadSRAMFromSMB (bool8 silent);
|
||||
void SavePrefsToSMB (bool8 silent);
|
||||
void LoadPrefsFromSMB (bool8 silent);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char gcip[16];
|
||||
char gwip[16];
|
||||
char mask[16];
|
||||
char smbip[16];
|
||||
char smbuser[20];
|
||||
char smbpwd[20];
|
||||
char smbgcid[20];
|
||||
char smbsvid[20];
|
||||
char smbshare[20];
|
||||
}
|
||||
SMBINFO;
|
||||
|
||||
|
||||
#endif
|
612
source/ngc/snes9xGX.cpp
Normal file
612
source/ngc/snes9xGX.cpp
Normal file
@ -0,0 +1,612 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007-July 2007
|
||||
*
|
||||
* snes9xGX.cpp
|
||||
*
|
||||
* This file controls overall program flow. Most things start and end here!
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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 <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "debug.h"
|
||||
#include "cpuexec.h"
|
||||
#include "ppu.h"
|
||||
#include "apu.h"
|
||||
#include "display.h"
|
||||
#include "gfx.h"
|
||||
#include "soundux.h"
|
||||
#include "spc700.h"
|
||||
#include "spc7110.h"
|
||||
#include "controls.h"
|
||||
|
||||
#include "snes9xGX.h"
|
||||
#include "dvd.h"
|
||||
#include "video.h"
|
||||
#include "ftfont.h"
|
||||
#include "s9xconfig.h"
|
||||
#include "audio.h"
|
||||
#include "menu.h"
|
||||
#include "sram.h"
|
||||
#include "memfile.h"
|
||||
#include "preferences.h"
|
||||
#include "gctime.h"
|
||||
|
||||
unsigned long ARAM_ROMSIZE = 0;
|
||||
int ConfigRequested = 0;
|
||||
extern int FrameTimer;
|
||||
|
||||
extern tb_t prev;
|
||||
extern unsigned int timediffallowed;
|
||||
|
||||
/****************************************************************************
|
||||
* Controller Functions
|
||||
*
|
||||
* The following map the NGC Pads to the *NEW* controller system.
|
||||
****************************************************************************/
|
||||
#define ASSIGN_BUTTON_TRUE( keycode, snescmd ) \
|
||||
S9xMapButton( keycode, cmd = S9xGetCommandT(snescmd), true)
|
||||
|
||||
#define ASSIGN_BUTTON_FALSE( keycode, snescmd ) \
|
||||
S9xMapButton( keycode, cmd = S9xGetCommandT(snescmd), false)
|
||||
|
||||
#define MAXJP 12
|
||||
int padcal = 50;
|
||||
unsigned short gcpadmap[] = { PAD_BUTTON_A, PAD_BUTTON_B,
|
||||
PAD_BUTTON_X, PAD_BUTTON_Y,
|
||||
PAD_TRIGGER_L, PAD_TRIGGER_R,
|
||||
PAD_TRIGGER_Z, PAD_BUTTON_START,
|
||||
PAD_BUTTON_UP, PAD_BUTTON_DOWN,
|
||||
PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT
|
||||
};
|
||||
|
||||
#if 0
|
||||
/****************************************************************************
|
||||
* decodepad
|
||||
* Called per pad with offset
|
||||
****************************************************************************/
|
||||
void
|
||||
decodepadold (int pad)
|
||||
{
|
||||
int i, offset;
|
||||
signed char x, y;
|
||||
unsigned short jp;
|
||||
|
||||
/*** Do analogue updates ***/
|
||||
x = PAD_StickX (pad);
|
||||
y = PAD_StickY (pad);
|
||||
jp = PAD_ButtonsHeld (pad);
|
||||
|
||||
/*** Recalc left / right ***/
|
||||
if (x < -padcal)
|
||||
jp |= PAD_BUTTON_LEFT;
|
||||
if (x > padcal)
|
||||
jp |= PAD_BUTTON_RIGHT;
|
||||
|
||||
/*** Recalc up / down ***/
|
||||
if (y > padcal)
|
||||
jp |= PAD_BUTTON_UP;
|
||||
if (y < -padcal)
|
||||
jp |= PAD_BUTTON_DOWN;
|
||||
|
||||
/*** Fix offset to pad ***/
|
||||
offset = ((pad + 1) << 4);
|
||||
|
||||
for (i = 0; i < MAXJP; i++)
|
||||
{
|
||||
if (jp & gcpadmap[i])
|
||||
S9xReportButton (offset + i, true);
|
||||
else
|
||||
S9xReportButton (offset + i, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* This is the joypad algorithm submitted by Krullo.
|
||||
****************************************************************************/
|
||||
void
|
||||
decodepad (int pad)
|
||||
{
|
||||
int i, offset;
|
||||
signed char x, y;
|
||||
unsigned short jp;
|
||||
float t;
|
||||
|
||||
/*** Do analogue updates ***/
|
||||
x = PAD_StickX (pad);
|
||||
y = PAD_StickY (pad);
|
||||
jp = PAD_ButtonsHeld (pad);
|
||||
|
||||
/*** Is XY inside the "zone"? ***/
|
||||
if (x * x + y * y > padcal * padcal)
|
||||
{
|
||||
|
||||
/*** we don't want division by ZERO ***/
|
||||
if (x > 0 && y == 0)
|
||||
jp |= PAD_BUTTON_RIGHT;
|
||||
if (x < 0 && y == 0)
|
||||
jp |= PAD_BUTTON_LEFT;
|
||||
if (x == 0 && y > 0)
|
||||
jp |= PAD_BUTTON_UP;
|
||||
if (x == 0 && y < 0)
|
||||
jp |= PAD_BUTTON_DOWN;
|
||||
|
||||
if (x != 0 && y != 0)
|
||||
{
|
||||
|
||||
/*** Recalc left / right ***/
|
||||
t = (float) y / x;
|
||||
if (t >= -2.41421356237 && t < 2.41421356237)
|
||||
{
|
||||
if (x >= 0)
|
||||
jp |= PAD_BUTTON_RIGHT;
|
||||
else
|
||||
jp |= PAD_BUTTON_LEFT;
|
||||
}
|
||||
|
||||
/*** Recalc up / down ***/
|
||||
t = (float) x / y;
|
||||
if (t >= -2.41421356237 && t < 2.41421356237)
|
||||
{
|
||||
if (y >= 0)
|
||||
jp |= PAD_BUTTON_UP;
|
||||
else
|
||||
jp |= PAD_BUTTON_DOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*** Fix offset to pad ***/
|
||||
offset = ((pad + 1) << 4);
|
||||
|
||||
for (i = 0; i < MAXJP; i++)
|
||||
{
|
||||
if (jp & gcpadmap[i])
|
||||
S9xReportButton (offset + i, true);
|
||||
else
|
||||
S9xReportButton (offset + i, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* NGCReportButtons
|
||||
* Called on each rendered frame
|
||||
****************************************************************************/
|
||||
void
|
||||
NGCReportButtons ()
|
||||
{
|
||||
s8 px = PAD_SubStickX (0);
|
||||
s8 py = PAD_SubStickY (0);
|
||||
u16 pb = PAD_ButtonsHeld (0);
|
||||
|
||||
/*** Check for video zoom ***/
|
||||
if (GCSettings.NGCZoom)
|
||||
{
|
||||
if (py < -18 || py > 18)
|
||||
zoom ((float) py / -18);
|
||||
}
|
||||
|
||||
Settings.TurboMode = (px > 70);
|
||||
|
||||
/*** Check for menu:
|
||||
CStick left
|
||||
OR "L+R+X+Y" (eg. Hombrew/Adapted SNES controllers) ***/
|
||||
|
||||
if ((px < -70) ||
|
||||
((pb & PAD_TRIGGER_L) &&
|
||||
(pb & PAD_TRIGGER_R ) &&
|
||||
(pb & PAD_BUTTON_X) &&
|
||||
(pb & PAD_BUTTON_Y ))
|
||||
)
|
||||
{
|
||||
ConfigRequested = 1;
|
||||
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if ( GCSettings.AutoSave == 1 )
|
||||
{
|
||||
if ( WaitPromptChoice ("Save SRAM?", "Don't Save", "Save") )
|
||||
quickSaveSRAM ( SILENT );
|
||||
}
|
||||
else if ( GCSettings.AutoSave == 2 )
|
||||
{
|
||||
if ( WaitPromptChoice ("Save Freeze State?", "Don't Save", "Save") )
|
||||
quickSaveFreeze ( SILENT );
|
||||
}
|
||||
else if ( GCSettings.AutoSave == 3 )
|
||||
{
|
||||
if ( WaitPromptChoice ("Save SRAM and Freeze State?", "Don't Save", "Save") )
|
||||
{
|
||||
quickSaveSRAM ( SILENT );
|
||||
quickSaveFreeze ( SILENT );
|
||||
}
|
||||
}
|
||||
|
||||
mainmenu ();
|
||||
FrameTimer = 0;
|
||||
ConfigRequested = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int j = (Settings.MultiPlayer5Master == true ? 4 : 2);
|
||||
for (int i = 0; i < j; i++)
|
||||
decodepad (i);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Set the default mapping for NGC
|
||||
****************************************************************************/
|
||||
void
|
||||
SetDefaultButtonMap ()
|
||||
{
|
||||
int maxcode = 0x10;
|
||||
s9xcommand_t cmd;
|
||||
|
||||
/*** Joypad 1 ***/
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 A");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 B");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 X");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Y");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 L");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 R");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Select");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Start");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Up");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Down");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Left");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Right");
|
||||
|
||||
maxcode = 0x20;
|
||||
/*** Joypad 2 ***/
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 A");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 B");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 X");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Y");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 L");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 R");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Select");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Start");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Up");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Down");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Left");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Right");
|
||||
|
||||
maxcode = 0x30;
|
||||
/*** Joypad 3 ***/
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 A");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 B");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 X");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Y");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 L");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 R");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Select");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Start");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Up");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Down");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Left");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Right");
|
||||
|
||||
maxcode = 0x40;
|
||||
/*** Joypad 4 ***/
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 A");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 B");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 X");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Y");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 L");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 R");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Select");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Start");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Up");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Down");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Left");
|
||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Right");
|
||||
|
||||
if (Settings.MultiPlayer5Master == false)
|
||||
{
|
||||
/*** Plugin 2 Joypads by default ***/
|
||||
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||
S9xSetController (1, CTL_JOYPAD, 1, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||
S9xSetController (1, CTL_MP5, 1, 2, 3, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Emulation loop
|
||||
*
|
||||
* The 'clock' timer is long gone.
|
||||
* System now only uses vbl as hardware clock, so force PAL50 if you need 50hz
|
||||
****************************************************************************/
|
||||
/* Eke-Eke: initialize frame Sync */
|
||||
extern void S9xInitSync();
|
||||
|
||||
void
|
||||
emulate ()
|
||||
{
|
||||
|
||||
S9xSetSoundMute (TRUE);
|
||||
// FrameTimer = 0;
|
||||
AudioStart ();
|
||||
S9xInitSync();
|
||||
|
||||
while (1)
|
||||
{
|
||||
S9xMainLoop ();
|
||||
NGCReportButtons ();
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* MAIN
|
||||
*
|
||||
* Steps to Snes9x Emulation :
|
||||
* 1. Initialise GC Video
|
||||
* 2. Initialise libfreetype (Nice to read something)
|
||||
* 3. Set S9xSettings to standard defaults (s9xconfig.h)
|
||||
* 4. Allocate Snes9x Memory
|
||||
* 5. Allocate APU Memory
|
||||
* 6. Set Pixel format to RGB565 for GL Rendering
|
||||
* 7. Initialise Snes9x/GC Sound System
|
||||
* 8. Initialise Snes9x Graphics subsystem
|
||||
* 9. Let's Party!
|
||||
*
|
||||
* NB: The SNES ROM is now delivered from ARAM. (AR_SNESROM)
|
||||
* Any method of loading a ROM, RAM, DVD, SMB, SDCard,
|
||||
* MUST place the unpacked ROM at this location.
|
||||
* This provides a single consistent interface in memmap.cpp.
|
||||
* Refer to that file if you need to change it.
|
||||
****************************************************************************/
|
||||
int
|
||||
main ()
|
||||
{
|
||||
unsigned int save_flags;
|
||||
|
||||
/*** Initialise GC ***/
|
||||
InitGCVideo (); /*** Get the ball rolling ***/
|
||||
|
||||
#ifdef FORCE_WII
|
||||
isWii = TRUE;
|
||||
#else
|
||||
int drvid = dvd_driveid ();
|
||||
if ( drvid == 4 || drvid == 6 || drvid == 8 )
|
||||
isWii = FALSE;
|
||||
else
|
||||
isWii = TRUE;
|
||||
#endif
|
||||
|
||||
/*** Initialise freetype ***/
|
||||
if (FT_Init ())
|
||||
{
|
||||
printf ("Cannot initialise font subsystem!\n");
|
||||
while (1);
|
||||
}
|
||||
|
||||
/*** Set defaults ***/
|
||||
DefaultSettings ();
|
||||
|
||||
S9xUnmapAllControls ();
|
||||
SetDefaultButtonMap ();
|
||||
|
||||
printf ("Initialise Memory\n");
|
||||
/*** Allocate SNES Memory ***/
|
||||
if (!Memory.Init ())
|
||||
while (1);
|
||||
|
||||
printf ("Initialise APU\n");
|
||||
/*** Allocate APU ***/
|
||||
if (!S9xInitAPU ())
|
||||
while (1);
|
||||
|
||||
/*** Set Pixel Renderer to match 565 ***/
|
||||
S9xSetRenderPixelFormat (RGB565);
|
||||
|
||||
/*** Initialise Snes Sound System ***/
|
||||
S9xInitSound (5, TRUE, 1024);
|
||||
|
||||
printf ("Initialise GFX\n");
|
||||
/*** Initialise Graphics ***/
|
||||
setGFX ();
|
||||
if (!S9xGraphicsInit ())
|
||||
while (1);
|
||||
|
||||
legal ();
|
||||
WaitButtonA ();
|
||||
|
||||
// Load preferences
|
||||
quickLoadPrefs(SILENT);
|
||||
|
||||
// Correct any relevant saved settings that are invalid
|
||||
Settings.FrameTimeNTSC = 16667;
|
||||
Settings.FrameTimePAL = 20000;
|
||||
if ( Settings.TurboSkipFrames <= Settings.SkipFrames )
|
||||
Settings.TurboSkipFrames = 20;
|
||||
|
||||
/*** No appended ROM, so get the user to load one ***/
|
||||
if (ARAM_ROMSIZE == 0)
|
||||
{
|
||||
while (ARAM_ROMSIZE == 0)
|
||||
{
|
||||
mainmenu ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*** Load ROM ***/
|
||||
save_flags = CPU.Flags;
|
||||
if (!Memory.LoadROM ("VIRTUAL.ROM"))
|
||||
while (1);
|
||||
CPU.Flags = save_flags;
|
||||
|
||||
/*** Load SRAM ***/
|
||||
Memory.LoadSRAM ("DVD");
|
||||
|
||||
if ( GCSettings.AutoLoad == 1 )
|
||||
quickLoadSRAM ( SILENT );
|
||||
else if ( GCSettings.AutoLoad == 2 )
|
||||
quickLoadFreeze ( SILENT );
|
||||
}
|
||||
/*** Emulate ***/
|
||||
emulate ();
|
||||
|
||||
/*** NO! - We're never leaving here ! ***/
|
||||
while (1);
|
||||
return 0;
|
||||
|
||||
}
|
242
source/ngc/snes9xGX.h
Normal file
242
source/ngc/snes9xGX.h
Normal file
@ -0,0 +1,242 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007-July 2007
|
||||
*
|
||||
* snes9xGX.cpp
|
||||
*
|
||||
* This file controls overall program flow. Most things start and end here!
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _SNES9XGX_H_
|
||||
#define _SNES9XGX_H_
|
||||
|
||||
#include "snes9x.h"
|
||||
|
||||
#define GCVERSION "2.0.1b8"
|
||||
#define GCVERSIONSTRING "Snes9x GX 2.0.1b8"
|
||||
|
||||
#define NOTSILENT 0
|
||||
#define SILENT 1
|
||||
|
||||
struct SGCSettings{
|
||||
uint8 AutoLoad;
|
||||
uint8 AutoSave;
|
||||
char gcip[16];
|
||||
char gwip[16];
|
||||
char mask[16];
|
||||
char smbip[16];
|
||||
char smbuser[20];
|
||||
char smbpwd[20];
|
||||
char smbgcid[20];
|
||||
char smbsvid[20];
|
||||
char smbshare[20];
|
||||
bool8 NGCZoom;
|
||||
uint8 VerifySaves;
|
||||
};
|
||||
|
||||
START_EXTERN_C
|
||||
extern struct SGCSettings GCSettings;
|
||||
extern unsigned short saveicon[1024];
|
||||
extern bool8 isWii;
|
||||
END_EXTERN_C
|
||||
|
||||
#endif
|
||||
|
||||
/*** QUICK_SAVE_SLOT defines where preferences are loaded and saved, and also
|
||||
where SRAM and Freezes are auto loaded or saved if enabled:
|
||||
|
||||
-1 Disabled - no prefs are loaded
|
||||
0 Memory card in slot A
|
||||
1 Memory card in slot B
|
||||
2 SD card in slot A
|
||||
3 SD card in slot B
|
||||
4 SMB share ***/
|
||||
#ifndef QUICK_SAVE_SLOT
|
||||
#define QUICK_SAVE_SLOT 1
|
||||
#endif
|
||||
|
||||
/*** if defined, LOAD_TYPE specifies type of load allowed:
|
||||
0 = All load types allowed - show submenu
|
||||
1 = DVD only
|
||||
2 = SMB only
|
||||
3 = SD only
|
||||
This settings is something I use to allow me to make a version for my kids,
|
||||
where I want it to be easy and they'll never be using SD or SMB ***/
|
||||
#ifndef LOAD_TYPE
|
||||
#define LOAD_TYPE 0
|
||||
#endif
|
||||
|
||||
/*** default SMB settings ***/
|
||||
#ifndef GC_IP
|
||||
#define GC_IP "192.168.1.32" /*** IP to assign the GameCube ***/
|
||||
#endif
|
||||
#ifndef GW_IP
|
||||
#define GW_IP "192.168.1.100" /*** Your gateway IP ***/
|
||||
#endif
|
||||
#ifndef MASK
|
||||
#define MASK "255.255.255.0" /*** Your subnet mask ***/
|
||||
#endif
|
||||
#ifndef SMB_USER
|
||||
#define SMB_USER "Guest" /*** Your share user ***/
|
||||
#endif
|
||||
#ifndef SMB_PWD
|
||||
#define SMB_PWD "password" /*** Your share user password ***/
|
||||
#endif
|
||||
#ifndef SMB_GCID
|
||||
#define SMB_GCID "gamecube" /*** Machine Name of GameCube ***/
|
||||
#endif
|
||||
#ifndef SMB_SVID
|
||||
#define SMB_SVID "mypc" /*** Machine Name of Server(Share) ***/
|
||||
#endif
|
||||
#ifndef SMB_SHARE
|
||||
#define SMB_SHARE "gcshare" /*** Share name on server ***/
|
||||
#endif
|
||||
#ifndef SMB_IP
|
||||
#define SMB_IP "192.168.1.100" /*** IP Address of share server ***/
|
||||
#endif
|
271
source/ngc/sram.cpp
Normal file
271
source/ngc/sram.cpp
Normal file
@ -0,0 +1,271 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* crunchy2 April 2007-July 2007
|
||||
*
|
||||
* sram.cpp
|
||||
*
|
||||
* SRAM save/load/import/export handling
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "snes9xGx.h"
|
||||
#include "memmap.h"
|
||||
#include "srtc.h"
|
||||
#include "ftfont.h"
|
||||
#include "mcsave.h"
|
||||
#include "sdload.h"
|
||||
#include "smbload.h"
|
||||
|
||||
extern unsigned char savebuffer[];
|
||||
extern int currconfig[4];
|
||||
extern int padcal;
|
||||
extern unsigned short gcpadmap[];
|
||||
extern unsigned short padmap[4];
|
||||
|
||||
char sramcomment[2][32] = { {"Snes9x GX 2.0.1b8 SRAM"}, {"Savegame"} };
|
||||
|
||||
/****************************************************************************
|
||||
* Prepare Memory Card SRAM Save Data
|
||||
*
|
||||
* This sets up the save buffer for saving to a memory card.
|
||||
****************************************************************************/
|
||||
int
|
||||
prepareMCsavedata ()
|
||||
{
|
||||
int offset = sizeof (saveicon);
|
||||
int size;
|
||||
|
||||
ClearSaveBuffer ();
|
||||
|
||||
/*** Copy in save icon ***/
|
||||
memcpy (savebuffer, saveicon, offset);
|
||||
|
||||
/*** And the sramcomments ***/
|
||||
sprintf (sramcomment[1], "%s", Memory.ROMName);
|
||||
memcpy (savebuffer + offset, sramcomment, 64);
|
||||
offset += 64;
|
||||
|
||||
/*** Copy SRAM size ***/
|
||||
size = Memory.SRAMSize ? (1 << (Memory.SRAMSize + 3)) * 128 : 0;
|
||||
|
||||
if (size > 0x20000)
|
||||
size = 0x20000;
|
||||
|
||||
memcpy (savebuffer + offset, &size, 4);
|
||||
offset += 4;
|
||||
|
||||
/*** Copy SRAM ***/
|
||||
if (size != 0)
|
||||
{
|
||||
memcpy (savebuffer + offset, Memory.SRAM, size);
|
||||
offset += size;
|
||||
}
|
||||
|
||||
/*** Save Joypad Configuration ***/
|
||||
memcpy (savebuffer + offset, &currconfig, 16);
|
||||
offset += 16;
|
||||
memcpy (savebuffer + offset, &padcal, 4);
|
||||
offset += 4;
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Prepare Exportable SRAM Save Data
|
||||
*
|
||||
* This sets up the save buffer for saving in a format compatible with
|
||||
* snes9x on other platforms. This is used when saving to SD or SMB.
|
||||
****************************************************************************/
|
||||
int
|
||||
prepareEXPORTsavedata ()
|
||||
{
|
||||
int offset = 0;
|
||||
int size;
|
||||
|
||||
ClearSaveBuffer ();
|
||||
|
||||
/*** Copy in the sramcomments ***/
|
||||
sprintf (sramcomment[1], "%s", Memory.ROMName);
|
||||
memcpy (savebuffer + offset, sramcomment, 64);
|
||||
offset += 64;
|
||||
|
||||
/*** Save Joypad Configuration ***/
|
||||
memcpy (savebuffer + offset, &currconfig, 16);
|
||||
offset += 16;
|
||||
memcpy (savebuffer + offset, &padcal, 4);
|
||||
offset += 4;
|
||||
|
||||
if ( offset <= 512 )
|
||||
{
|
||||
// make it a 512 byte header so it is compatible with other platforms
|
||||
offset = 512;
|
||||
|
||||
/*** Copy in the SRAM ***/
|
||||
size = Memory.SRAMSize ? (1 << (Memory.SRAMSize + 3)) * 128 : 0;
|
||||
|
||||
if (size > 0x20000)
|
||||
size = 0x20000;
|
||||
|
||||
if (size != 0)
|
||||
{
|
||||
memcpy (savebuffer + offset, Memory.SRAM, size);
|
||||
offset += size;
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
// header was longer than 512 bytes - hopefully this never happens!
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Decode Save Data
|
||||
****************************************************************************/
|
||||
void
|
||||
decodesavedata (int readsize)
|
||||
{
|
||||
int offset;
|
||||
int size;
|
||||
char sramcomment[32];
|
||||
|
||||
// Check for exportable format sram - it has the sram comment at the start
|
||||
memcpy (sramcomment, savebuffer, 32);
|
||||
|
||||
if ( strncmp (sramcomment, "Snes9x GX 2.0", 13) == 0 )
|
||||
{
|
||||
offset = 64;
|
||||
|
||||
// Get the control pad configuration
|
||||
memcpy (&currconfig, savebuffer + offset, 16);
|
||||
offset += 16;
|
||||
memcpy (&padcal, savebuffer + offset, 4);
|
||||
offset += 4;
|
||||
|
||||
for (size = 0; size < 4; size++)
|
||||
gcpadmap[size] = padmap[currconfig[size]];
|
||||
|
||||
// move to start of SRAM which is after the 512 byte header
|
||||
offset = 512;
|
||||
|
||||
// import the SRAM
|
||||
size = Memory.SRAMSize ? (1 << (Memory.SRAMSize + 3)) * 128 : 0;
|
||||
|
||||
if (size > 0x20000)
|
||||
size = 0x20000;
|
||||
|
||||
memcpy (Memory.SRAM, savebuffer + offset, size);
|
||||
offset += size;
|
||||
}
|
||||
else
|
||||
{
|
||||
// else, check for a v2.0 memory card format save
|
||||
offset = sizeof (saveicon);
|
||||
memcpy (sramcomment, savebuffer + offset, 32);
|
||||
|
||||
if ( strncmp (sramcomment, "Snes9x GX 2.0", 13) == 0 )
|
||||
{
|
||||
//WaitPrompt ("Memory Card format save");
|
||||
offset += 64;
|
||||
memcpy (&size, savebuffer + offset, 4);
|
||||
offset += 4;
|
||||
memcpy (Memory.SRAM, savebuffer + offset, size);
|
||||
offset += size;
|
||||
|
||||
// If it is an old 2.0 format save, skip over the Settings as we
|
||||
// don't save them in SRAM now
|
||||
if ( strcmp (sramcomment, "Snes9x GX 2.0") == 0 )
|
||||
offset += sizeof (Settings);
|
||||
|
||||
// Get the control pad configuration
|
||||
memcpy (&currconfig, savebuffer + offset, 16);
|
||||
offset += 16;
|
||||
memcpy (&padcal, savebuffer + offset, 4);
|
||||
offset += 4;
|
||||
|
||||
for (size = 0; size < 4; size++)
|
||||
gcpadmap[size] = padmap[currconfig[size]];
|
||||
}
|
||||
else if ( strncmp (sramcomment, "Snes9x 1.43 SRAM (GX", 20) == 0)
|
||||
{
|
||||
// it's an older SnesGx memory card format save
|
||||
size = Memory.SRAMSize ? ( 1 << (Memory.SRAMSize + 3)) * 128 : 0;
|
||||
|
||||
// import the SRAM
|
||||
if ( size )
|
||||
memcpy(&Memory.SRAM[0], &savebuffer[sizeof(saveicon)+68], size);
|
||||
|
||||
// Ignore the settings saved in the file
|
||||
|
||||
// NOTE: need to add import of joypad config?? Nah.
|
||||
}
|
||||
else
|
||||
{
|
||||
// else, check for SRAM from other version/platform of snes9x
|
||||
size = Memory.SRAMSize ? (1 << (Memory.SRAMSize + 3)) * 128 : 0;
|
||||
|
||||
if ( readsize == size || readsize == size + SRTC_SRAM_PAD)
|
||||
{
|
||||
//WaitPrompt("readsize=size or + SRTC_SRAM_PAD");
|
||||
// SRAM data should be at the start of the file, just import it and
|
||||
// ignore anything after the SRAM
|
||||
memcpy (Memory.SRAM, savebuffer, size);
|
||||
}
|
||||
else if ( readsize == size + 512 )
|
||||
{
|
||||
//WaitPrompt("readsize=size+512");
|
||||
// SRAM has a 512 byte header - remove it, then import the SRAM,
|
||||
// ignoring anything after the SRAM
|
||||
memmove (savebuffer, savebuffer + 512, size);
|
||||
memcpy (Memory.SRAM, savebuffer, size);
|
||||
}
|
||||
else
|
||||
WaitPrompt("Incompatible SRAM save!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void quickLoadSRAM (bool8 silent)
|
||||
{
|
||||
switch ( QUICK_SAVE_SLOT )
|
||||
{
|
||||
case CARD_SLOTA:
|
||||
case CARD_SLOTB:
|
||||
LoadSRAMFromMC(QUICK_SAVE_SLOT, silent);
|
||||
break;
|
||||
case CARD_SLOTA+2:
|
||||
case CARD_SLOTB+2:
|
||||
LoadSRAMFromSD(QUICK_SAVE_SLOT-2, silent);
|
||||
break;
|
||||
case CARD_SLOTA+4:
|
||||
LoadSRAMFromSMB(SILENT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void quickSaveSRAM (bool8 silent)
|
||||
{
|
||||
switch ( QUICK_SAVE_SLOT )
|
||||
{
|
||||
case CARD_SLOTA:
|
||||
case CARD_SLOTB:
|
||||
SaveSRAMToMC(QUICK_SAVE_SLOT, silent);
|
||||
break;
|
||||
case CARD_SLOTA+2:
|
||||
case CARD_SLOTB+2:
|
||||
SaveSRAMToSD(QUICK_SAVE_SLOT-2, silent);
|
||||
break;
|
||||
case CARD_SLOTA+4:
|
||||
SaveSRAMToSMB(SILENT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
17
source/ngc/sram.h
Normal file
17
source/ngc/sram.h
Normal file
@ -0,0 +1,17 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Port
|
||||
* crunchy2 April 2007
|
||||
*
|
||||
* sram.cpp
|
||||
*
|
||||
* SRAM save/load/import/export handling
|
||||
****************************************************************************/
|
||||
|
||||
int prepareMCsavedata ();
|
||||
int prepareEXPORTsavedata ();
|
||||
void decodesavedata (int readsize);
|
||||
|
||||
void quickLoadSRAM (bool8 silent);
|
||||
void quickSaveSRAM (bool8 silent);
|
556
source/ngc/tempgfx.h
Normal file
556
source/ngc/tempgfx.h
Normal file
@ -0,0 +1,556 @@
|
||||
/*******************************************************************
|
||||
* Image File : ..\snesGX2.bmp
|
||||
* Width : 640
|
||||
* Height : 480
|
||||
*
|
||||
* This header contains a compressed Zip image.
|
||||
* Use zlib1.2.3 uncompress function to restore.
|
||||
*******************************************************************/
|
||||
|
||||
#define tempgfx_RAW 614400
|
||||
#define tempgfx_COMPRESSED 8647
|
||||
#define tempgfx_WIDTH 640
|
||||
#define tempgfx_HEIGHT 480
|
||||
|
||||
unsigned char tempgfx[8647] = {
|
||||
0x78,0xda,0xed,0x9d,0xd9,0x77,0x14,0x47,0x9e,0xef,0xf9,0xdb,0xee,0xcb,0x9d,0x99,
|
||||
0x3b,0x67,0x66,0x7a,0xe6,0x9c,0xdb,0xe3,0xf6,0x9d,0xde,0x6c,0xb7,0xdb,0xdd,0xee,
|
||||
0xf6,0xc2,0x8e,0xa9,0x88,0x5f,0xa6,0x58,0x8d,0x31,0x60,0xcc,0x2a,0x30,0x8b,0x58,
|
||||
0x2c,0x10,0x48,0x2c,0x02,0x81,0x16,0xb4,0x21,0xb4,0x21,0xc4,0x22,0x21,0xc0,0x02,
|
||||
0x03,0x9e,0x87,0xee,0x73,0x6e,0x9f,0xe3,0x7e,0xe8,0x97,0x7e,0xb8,0xf7,0x17,0x51,
|
||||
0x59,0xa5,0xcc,0x92,0x4a,0xca,0x12,0x2a,0x55,0x09,0x3e,0xfd,0x3d,0x9f,0x36,0x52,
|
||||
0xe5,0x12,0x99,0x59,0xf9,0x51,0x44,0x46,0x64,0xe6,0x32,0x59,0x46,0x08,0x21,0x84,
|
||||
0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,
|
||||
0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0xbc,0xa6,
|
||||
0xe9,0x91,0x2b,0x72,0x46,0x8e,0xcb,0x7e,0xd9,0x47,0x08,0x21,0x65,0xc9,0x7e,0x75,
|
||||
0xcc,0x19,0x75,0x4d,0x4f,0xd5,0x98,0xaf,0x5d,0xce,0xcb,0x37,0x52,0x4b,0x08,0x21,
|
||||
0x8b,0x96,0x6f,0xd4,0x3b,0xed,0x15,0xb7,0x5f,0xb3,0xfa,0x98,0x10,0x42,0x2a,0x91,
|
||||
0xe6,0x0a,0xba,0xef,0x96,0x5c,0x94,0x7a,0x42,0x08,0xa9,0x58,0x2e,0xaa,0x87,0x2a,
|
||||
0x61,0xbf,0x6e,0xb9,0xa4,0xeb,0x26,0x84,0x90,0x4a,0xe6,0x92,0xba,0x68,0xf1,0xfb,
|
||||
0x3b,0xae,0x11,0x42,0x48,0x55,0xa4,0x67,0x91,0x5b,0xbe,0xad,0x84,0x10,0x52,0x35,
|
||||
0x59,0xbc,0x56,0xf0,0x90,0x74,0x48,0xdb,0xb4,0x74,0x49,0xbf,0x19,0x92,0x3b,0xe6,
|
||||
0x4e,0x00,0x00,0x50,0x1e,0x86,0xd4,0x33,0x5d,0xd2,0x66,0x0b,0xfd,0xd3,0xa1,0x5e,
|
||||
0x5a,0xac,0xb6,0x6f,0x47,0x41,0x3a,0x65,0x88,0x63,0x03,0x00,0x8b,0x83,0xfa,0xa6,
|
||||
0x53,0x3a,0x6c,0xd2,0x42,0x8b,0xd3,0x06,0xee,0x97,0x1b,0x05,0xe9,0xb3,0x23,0xd4,
|
||||
0xfb,0x00,0x60,0x11,0x19,0x91,0x3e,0x53,0x68,0xa2,0xfe,0x45,0xf0,0x5f,0xaf,0xd6,
|
||||
0xf6,0xe2,0xe9,0xc7,0x7d,0x00,0x50,0x01,0xfa,0xa5,0xd3,0xc6,0x5d,0xd4,0xbb,0x28,
|
||||
0xad,0xdf,0xee,0x58,0xfa,0x2c,0xc7,0x01,0x00,0x2a,0xd3,0x0e,0xee,0x33,0x71,0x1b,
|
||||
0x95,0xbf,0x05,0x3c,0xa8,0xeb,0x88,0x67,0x04,0xff,0x01,0x40,0x85,0xfc,0x77,0xdb,
|
||||
0x24,0x7d,0x34,0x58,0x66,0xff,0x0d,0xc8,0xcd,0x58,0x68,0xfb,0x02,0x40,0x65,0xdb,
|
||||
0xc0,0x37,0x6d,0xdc,0x48,0xe5,0xee,0xfd,0xe8,0x8b,0x85,0xf1,0x2e,0x00,0x50,0xd9,
|
||||
0xf1,0x30,0x7d,0x76,0xca,0x48,0xb7,0xca,0x5e,0xff,0xeb,0x8f,0x65,0x84,0xfd,0x0f,
|
||||
0x00,0x15,0xed,0x07,0xee,0xb7,0x71,0x27,0x95,0xdb,0x7f,0xf1,0xb0,0xff,0x01,0xa0,
|
||||
0xb2,0xd7,0x00,0x07,0x6c,0xdc,0x49,0xe5,0xee,0xff,0x88,0x87,0xfd,0x0f,0x00,0x95,
|
||||
0xf5,0xdf,0xa0,0x8d,0x3b,0xa9,0xbc,0xfe,0x1b,0x49,0x84,0xfd,0x0f,0x00,0x95,0xf5,
|
||||
0xdf,0xb0,0x1d,0x96,0xa9,0x94,0xd7,0x7f,0xb7,0x13,0x61,0xff,0x03,0x40,0x85,0xc7,
|
||||
0xc0,0xd8,0xb8,0x93,0xa8,0xff,0x01,0xc0,0x9b,0xe3,0xbf,0x11,0x1b,0x77,0x52,0x79,
|
||||
0xfd,0x77,0x27,0x19,0xf6,0x3f,0x00,0x54,0xd4,0x7f,0x77,0x6c,0xdc,0x49,0xe5,0xf5,
|
||||
0xdf,0xdd,0x44,0xd8,0xff,0x73,0x1d,0x9b,0xcb,0x66,0x9b,0xac,0xb6,0xab,0x65,0xee,
|
||||
0x6c,0x93,0xba,0x45,0xbb,0x97,0xe6,0xb2,0x6c,0x33,0x69,0xca,0xa4,0xa5,0xb2,0x75,
|
||||
0x6e,0x8c,0xa7,0x34,0xa6,0xda,0x8e,0x6d,0xd2,0xc8,0xfd,0x40,0xb0,0xc8,0xe7,0xd8,
|
||||
0x5d,0x1b,0x77,0x52,0x79,0xfd,0x77,0x2f,0x11,0xf6,0xff,0xac,0xd7,0x65,0xcd,0x9e,
|
||||
0x94,0xee,0xcb,0xe5,0xa8,0x7c,0x6e,0xd3,0x7a,0xa9,0x31,0x37,0xf6,0x3c,0xa5,0x9b,
|
||||
0x72,0x8e,0x1d,0x96,0x3d,0xa6,0x94,0x32,0x69,0xa9,0xec,0xee,0x12,0xb6,0xe3,0xac,
|
||||
0x0c,0x99,0x63,0x5a,0xbe,0xe4,0x7a,0xaf,0xc7,0xf6,0xcb,0xf5,0x82,0xf2,0x46,0x8e,
|
||||
0x9d,0x63,0x7f,0xf6,0xc9,0x61,0xb3,0x25,0xf5,0x76,0x76,0x9a,0xba,0x05,0x2a,0xc3,
|
||||
0xb0,0xec,0x33,0x61,0xaa,0xf5,0xae,0xb7,0xbb,0xe2,0xeb,0x28,0xa0,0xb1,0xa0,0x3c,
|
||||
0x73,0x1e,0x57,0x48,0x79,0x9e,0xdd,0xb3,0x71,0x27,0x95,0xd7,0x7f,0xf7,0x13,0x61,
|
||||
0xff,0xcf,0x76,0x5c,0x9c,0x67,0x32,0xf6,0xe4,0x86,0x3b,0x99,0x3b,0x9b,0xee,0xac,
|
||||
0x9f,0x8b,0xab,0xe1,0xea,0x12,0xbd,0xb4,0xdb,0xf6,0x07,0x03,0xe6,0xeb,0x12,0x1d,
|
||||
0xeb,0x5c,0x96,0x09,0x4e,0x9a,0x34,0x65,0xba,0xb3,0xf1,0xea,0xfa,0xd5,0xf2,0xb9,
|
||||
0xb8,0xed,0x38,0x9b,0x62,0x3b,0xce,0x06,0xae,0x2c,0x33,0x9f,0xe7,0x57,0xd5,0x8b,
|
||||
0xc3,0xc1,0x6d,0x73,0x7d,0xc6,0xf2,0x6e,0xb7,0x43,0xc1,0xb0,0xb9,0x1d,0x8c,0x98,
|
||||
0x19,0xc7,0xd4,0xab,0xcf,0x4c,0x49,0xfb,0xa6,0x46,0x16,0xaa,0x0c,0xfb,0x4a,0xdc,
|
||||
0xbf,0x67,0xa3,0x75,0x8c,0xe8,0x72,0xa6,0x1c,0x5a,0xca,0xdf,0x1c,0x77,0x5c,0x67,
|
||||
0xd9,0x17,0x15,0x19,0x63,0x7c,0xd3,0xdc,0xf4,0x74,0xeb,0xbe,0xbb,0xee,0xb9,0x22,
|
||||
0x4d,0xb6,0xc9,0x73,0xce,0x9e,0x92,0x53,0x33,0x72,0x42,0x0e,0xd9,0x43,0x52,0x98,
|
||||
0x13,0x05,0xd3,0x9d,0xf5,0xcb,0xb9,0xe2,0x97,0xdb,0xed,0xd7,0x73,0xbb,0xa4,0xf3,
|
||||
0xec,0xbe,0x8d,0x3b,0xa9,0xbc,0xfe,0x7b,0x90,0x08,0x9e,0xbb,0x33,0xcb,0xdf,0x7b,
|
||||
0xf5,0x4c,0x38,0x90,0x19,0xdf,0x38,0xbe,0x3e,0x0d,0x6d,0x81,0xfa,0x2f,0x68,0x33,
|
||||
0xa9,0xa6,0xaf,0x69,0x5a,0x9f,0xd1,0xe5,0xef,0x94,0x5d,0xd6,0xb9,0xa9,0xa9,0xa6,
|
||||
0x84,0x75,0xe8,0xf4,0x03,0x1b,0xd2,0x4d,0x3f,0xbe,0xa1,0x6d,0xbd,0x3b,0x23,0x53,
|
||||
0x6f,0x87,0x96,0xcb,0xdb,0xa7,0x60,0x3b,0xea,0xbc,0x17,0x9b,0x6c,0xaf,0x34,0x7b,
|
||||
0x0f,0xd4,0xd5,0x8c,0x67,0xe2,0xeb,0x50,0x5b,0xd9,0x16,0xe9,0x33,0x03,0xd1,0x79,
|
||||
0x5f,0xb8,0x2f,0x3b,0x65,0x8d,0xce,0xbf,0xd7,0xf6,0xa4,0x2c,0xf7,0x4e,0x5d,0xde,
|
||||
0x42,0x95,0xc1,0xd5,0xfd,0x52,0xed,0xaf,0x0d,0xa3,0xd1,0x3a,0x4e,0xe9,0x3a,0xfa,
|
||||
0xcd,0x90,0x77,0x60,0x76,0x19,0x7b,0xfc,0xdf,0x9c,0x26,0x93,0xfe,0xb8,0xf6,0x9a,
|
||||
0x5b,0xc1,0xe0,0x8c,0xfb,0xa2,0x0c,0xf7,0xcf,0xaa,0x73,0xba,0x22,0xaf,0x65,0x9d,
|
||||
0xf6,0x6d,0xe4,0xa6,0xc3,0x72,0xa8,0x82,0x39,0xa5,0xe5,0x68,0xb2,0x97,0xb4,0x5c,
|
||||
0x9d,0xb3,0x39,0x51,0x1e,0xd8,0xb8,0x93,0xca,0xeb,0xbf,0xb1,0x44,0xf0,0x5c,0x71,
|
||||
0x76,0xe9,0xf7,0xf8,0x72,0x38,0x99,0x99,0xac,0x49,0x47,0xb7,0xf7,0x5f,0xb7,0x49,
|
||||
0x3b,0xfd,0x9d,0xc0,0xf8,0xf3,0xd8,0xe8,0xba,0x4a,0x5b,0xc7,0x65,0x9b,0x76,0xfa,
|
||||
0xc9,0xb0,0x3b,0xe3,0xd6,0x51,0xca,0x76,0xe4,0xda,0x95,0x89,0x79,0xc2,0x53,0x7e,
|
||||
0x39,0xf5,0x92,0xf5,0x43,0x7c,0xfa,0xcb,0xde,0x19,0x9b,0xed,0x35,0xad,0xe3,0xf5,
|
||||
0xca,0xc0,0x8c,0xe7,0xbc,0xdb,0x97,0x47,0x4a,0x28,0xc3,0xae,0x05,0x2c,0x83,0xf3,
|
||||
0xdf,0x9d,0xd4,0xfb,0xeb,0xb2,0xae,0x43,0xe4,0x4a,0x70,0x63,0x6a,0x39,0x7a,0xfe,
|
||||
0xea,0x51,0x92,0x3b,0x25,0x1d,0xd7,0x6f,0x6d,0x7b,0xd0,0xab,0x6e,0x1a,0x7e,0xf5,
|
||||
0x3a,0xa0,0x3a,0xfd,0xa6,0xf4,0x78,0xbf,0x35,0x27,0xea,0x6b,0x87,0xed,0x21,0x59,
|
||||
0x5a,0x39,0xa5,0xfb,0xa5,0x49,0xae,0xa9,0x0f,0x6f,0xc5,0xb6,0x6f,0xcc,0xc6,0x9d,
|
||||
0x54,0x5e,0xff,0x8d,0x27,0x82,0xe7,0x8a,0xb3,0x5e,0xcf,0x9b,0xc9,0xf0,0x87,0xcc,
|
||||
0x0f,0x35,0xe9,0xb8,0xe5,0xce,0xc1,0xe0,0x96,0x4d,0x3b,0xfd,0x0f,0x61,0x7d,0xf6,
|
||||
0x7c,0x2e,0x79,0x1d,0x93,0x26,0xfd,0x3a,0x6e,0xf9,0x75,0x94,0xb2,0x1d,0x17,0x74,
|
||||
0xbb,0xb3,0xd7,0xcb,0x2e,0x24,0xb6,0xa5,0x3e,0x72,0x52,0xa2,0xbc,0x61,0x8b,0x5f,
|
||||
0xfe,0xe7,0x72,0xd2,0x9c,0x97,0x16,0xff,0xbd,0x1e,0x9e,0xe6,0xbf,0x01,0xe7,0x8f,
|
||||
0x92,0xf6,0xa5,0x6b,0xe3,0x7f,0xbe,0x40,0x65,0x70,0xdb,0x32,0x56,0x53,0xda,0xba,
|
||||
0xf7,0xcb,0x05,0xd3,0xaa,0x75,0xb8,0x41,0xad,0x03,0xde,0x91,0x3a,0x2d,0x7f,0x7d,
|
||||
0x89,0xc7,0xf5,0x4b,0x7b,0x5e,0xcf,0xf3,0xee,0x60,0x20,0x75,0x1d,0xd0,0xb5,0x1b,
|
||||
0x3b,0x7d,0x1d,0xee,0xa2,0x69,0x92,0x46,0xef,0xb8,0x63,0x33,0xb6,0x3f,0x5f,0x97,
|
||||
0x9c,0xb4,0x0d,0x72,0xc9,0xb6,0xca,0xb8,0x8d,0x3b,0xa9,0xbc,0xfe,0x7b,0x98,0x08,
|
||||
0x9e,0x2b,0x8e,0x3b,0xa7,0xfe,0x1c,0xfe,0xd9,0xe4,0x48,0xd7,0x17,0x32,0x64,0xe3,
|
||||
0xf3,0xcc,0x4a,0x30,0xe4,0xd7,0x31,0x14,0xa4,0x9c,0x5e,0x19,0x72,0x65,0x08,0xfe,
|
||||
0x3c,0xb5,0x8e,0x20,0xdd,0x75,0xa9,0xb9,0xb6,0xa3,0x2d,0x56,0x86,0x36,0xfd,0x7c,
|
||||
0x8d,0x6c,0xf0,0xd3,0x34,0xc4,0xcb,0x16,0x34,0xe8,0xba,0x1a,0x12,0xdb,0xd7,0xe0,
|
||||
0x97,0x65,0xec,0x16,0xf9,0xda,0x1c,0x57,0x67,0xb4,0x07,0x37,0xb5,0xdd,0x58,0x70,
|
||||
0xbe,0xcb,0x55,0x9d,0x6f,0x4f,0xfa,0xfd,0x12,0x95,0x71,0x63,0xd4,0x97,0xf4,0xaa,
|
||||
0x65,0x70,0xfe,0x7b,0x52,0xc2,0xba,0x2f,0xbb,0xb6,0xb7,0x1c,0x35,0x8d,0xd2,0x6e,
|
||||
0xfa,0xb4,0x2d,0x3d,0x22,0x5f,0x9a,0xd2,0x8f,0x6b,0x46,0xcf,0xef,0x06,0x75,0x59,
|
||||
0xef,0xb4,0xfd,0x71,0x4b,0x3d,0x77,0x43,0x3d,0x77,0x55,0xeb,0x72,0x8d,0xbe,0x1e,
|
||||
0x77,0xe4,0x35,0x76,0x5c,0x9a,0x24,0x9d,0x54,0x5e,0xff,0x4d,0x24,0x82,0xe7,0x66,
|
||||
0xf7,0xdf,0x8f,0xc1,0x8f,0x26,0xc7,0x5c,0xd7,0xd1,0x57,0xc8,0x4a,0xfd,0x7c,0xd4,
|
||||
0xe6,0xe7,0x29,0x32,0xfd,0xd4,0xe7,0xcf,0xfd,0x3a,0x46,0x63,0xeb,0x48,0x77,0x7d,
|
||||
0xfd,0xc7,0xd8,0x3a,0xf6,0xcd,0x31,0xcf,0x0a,0x9b,0x66,0x3b,0x3a,0x65,0xea,0xf3,
|
||||
0x4e,0xfd,0xfc,0x13,0x59,0x1f,0xd5,0xbf,0x1a,0x6d,0x7c,0xde,0x78,0x59,0x7f,0x94,
|
||||
0x46,0xbf,0xee,0x4f,0x64,0xb9,0x35,0xb2,0xc3,0x6c,0x8b,0x9c,0x39,0x53,0x9f,0xe8,
|
||||
0x6a,0xd9,0x17,0x2b,0x73,0x67,0xaa,0xed,0x14,0xad,0x43,0x7d,0x55,0x62,0x19,0x8e,
|
||||
0x4a,0x93,0xfa,0xaf,0x2f,0x51,0xff,0x4b,0xd3,0xff,0x11,0x5f,0x66,0xa7,0xf7,0xff,
|
||||
0x97,0xf6,0xb8,0x5c,0x36,0x5d,0x5a,0x7f,0xcb,0xfa,0x6f,0xa6,0xe3,0xfa,0x3c,0x71,
|
||||
0x1c,0xa6,0xca,0x38,0xea,0xcb,0xb4,0x55,0xf6,0x9a,0xd3,0x5a,0xbe,0xcb,0xd2,0xac,
|
||||
0xf5,0xb9,0xf3,0x55,0x70,0x3d,0xae,0x5a,0x93,0x74,0x12,0xfe,0xab,0x9e,0xf6,0xef,
|
||||
0x5f,0x82,0xbf,0xd9,0xbf,0x45,0x1c,0x98,0xe3,0x3c,0x5a,0xe5,0x3f,0x7f,0x90,0x9f,
|
||||
0xfe,0x6f,0x45,0xa6,0xcf,0x7f,0x1e,0xfc,0xb7,0xff,0xfc,0x81,0x4c,0xad,0x63,0x6e,
|
||||
0x2b,0xe8,0x5a,0xe4,0x2f,0xb1,0x75,0x1c,0xb0,0x73,0x4f,0xaf,0x73,0xc4,0xb6,0x63,
|
||||
0x2e,0x7a,0xb4,0xdc,0x1f,0xca,0xc7,0xbe,0x3e,0xe5,0xe6,0x3d,0x23,0x33,0x4f,0x77,
|
||||
0xc6,0x6f,0xdf,0x6f,0xec,0xbb,0xf2,0x91,0xb5,0xb2,0x61,0x0e,0xa7,0x1d,0x88,0x95,
|
||||
0xb9,0x67,0xce,0xed,0x5c,0xa9,0x7f,0x4b,0xc4,0xfb,0xec,0x68,0x09,0x65,0xd8,0x65,
|
||||
0x4e,0xc8,0x25,0xf5,0x57,0x7f,0xa2,0xcd,0x39,0xac,0xcb,0x59,0x2d,0x5b,0xa4,0x47,
|
||||
0xd2,0x6d,0x7f,0xab,0xf7,0x7f,0xc6,0xee,0xd5,0xfa,0x5b,0x9b,0x5b,0x96,0xf7,0xdf,
|
||||
0xf4,0xe3,0x7a,0x51,0x92,0xfb,0x6c,0xea,0xf3,0x07,0xfa,0xf9,0x87,0xf2,0xb6,0xfc,
|
||||
0x41,0x8c,0x6c,0x93,0x3d,0x72,0x10,0xc7,0x55,0x8d,0xff,0x1e,0x25,0x82,0xe7,0x66,
|
||||
0xef,0xff,0x68,0x96,0xbf,0xdb,0xbf,0xcf,0xc9,0x73,0x9d,0xce,0x9d,0x11,0x9f,0xe9,
|
||||
0xf7,0x7e,0x22,0xf6,0x7b,0x77,0x9e,0xfc,0x93,0xfd,0x77,0xf9,0xb9,0xfd,0x40,0x7d,
|
||||
0xb2,0xd2,0xf7,0x81,0xae,0x96,0xa9,0xcf,0xff,0xe4,0x7f,0x9e,0x48,0xb5,0x0e,0x47,
|
||||
0x9f,0xcd,0xd6,0xe7,0x9a,0x25,0xcd,0xf4,0xcf,0x25,0x5b,0x2a,0xf5,0xb8,0xf4,0xa5,
|
||||
0x5e,0xc7,0xdf,0x6d,0x9f,0x96,0xfb,0x03,0x79,0xdf,0x86,0x52,0x6b,0x0e,0xfb,0x32,
|
||||
0x1f,0x9c,0x61,0x7d,0x07,0x7d,0xd9,0x7f,0x25,0x6f,0xdb,0xf7,0xb4,0x4c,0x9b,0x45,
|
||||
0x4c,0x72,0xdb,0xe3,0x34,0x17,0x2c,0xa3,0xcf,0x3b,0xeb,0x5f,0xe4,0x3f,0xed,0x3b,
|
||||
0xf2,0xa1,0xfd,0x54,0x56,0x39,0xc7,0x15,0x3a,0x51,0xdb,0xbf,0xbb,0x6d,0x9d,0xd6,
|
||||
0xe7,0x4e,0xa7,0x2e,0x43,0xad,0x69,0x08,0x5a,0x4d,0xaf,0x24,0xfb,0x5d,0xeb,0x74,
|
||||
0x59,0x5b,0xe5,0xaf,0xa9,0xb7,0xff,0xa0,0x2e,0xf3,0x5d,0xad,0x4f,0x7e,0x29,0xa7,
|
||||
0xcc,0x35,0xad,0x4b,0x66,0xfd,0x57,0x78,0x5c,0xb7,0xc6,0xca,0xf3,0x57,0x75,0x75,
|
||||
0xfc,0xb8,0x4e,0xe8,0xe7,0x1f,0xc8,0xbf,0xcb,0x7b,0xb2,0x56,0xbd,0xbb,0xbb,0x6a,
|
||||
0xfc,0x77,0x58,0x72,0x63,0x56,0xea,0xf3,0x63,0x5f,0x2e,0xdb,0xdc,0x78,0x98,0xf6,
|
||||
0xfc,0x18,0x99,0x42,0xfa,0x8a,0x5e,0xaf,0x8c,0xd3,0x96,0xed,0x7f,0xce,0xd7,0x75,
|
||||
0x8f,0xa7,0xbe,0x76,0x99,0x74,0x52,0x79,0xfd,0xf7,0x38,0x11,0x3c,0x57,0x9c,0xec,
|
||||
0x18,0xb3,0x27,0xf2,0xff,0x52,0xe5,0xff,0x8a,0xf8,0xf3,0x36,0x3e,0xbd,0xfb,0xf9,
|
||||
0x7f,0xd9,0xb7,0xe4,0xf7,0x76,0x9d,0x6c,0x32,0xdb,0xb5,0x7e,0xe2,0x7e,0x13,0x9f,
|
||||
0xa7,0x70,0x8e,0xd9,0x33,0xe0,0xea,0x73,0xb6,0x94,0x79,0x72,0xa5,0x12,0xfd,0x57,
|
||||
0x29,0x6b,0xf9,0xad,0xbc,0xa7,0xe7,0xf4,0x41,0x73,0x4a,0x44,0xd7,0x57,0x3b,0xc3,
|
||||
0x54,0xb5,0x3a,0xd5,0xa7,0x5a,0xc7,0xf9,0xb9,0xd6,0x15,0xc5,0xee,0x91,0x1a,0x53,
|
||||
0xbc,0x54,0x57,0x24,0xb9,0x0c,0xb7,0x86,0xf7,0xec,0x4f,0xe4,0x97,0x5a,0xcf,0xb2,
|
||||
0x66,0xab,0xd6,0xcf,0x02,0x37,0x46,0xa5,0x60,0xe9,0x5b,0xd4,0x67,0xf5,0x72,0xc5,
|
||||
0x34,0x4b,0x90,0xb2,0x0c,0xa7,0xcd,0x55,0xe9,0x9a,0xd6,0xe7,0xea,0xfa,0xb3,0x4b,
|
||||
0xdb,0xc7,0x1f,0xcb,0x7f,0x6a,0x7d,0x72,0x93,0x1c,0xd6,0xf5,0x5f,0x30,0x97,0x64,
|
||||
0x93,0x9d,0x7e,0x5c,0xe3,0x3f,0x9f,0x93,0xe4,0x71,0x7d,0xe2,0xf7,0xe0,0x3f,0xcb,
|
||||
0x2f,0xb5,0x1e,0xbb,0x49,0xbe,0x5a,0x14,0xff,0xd5,0x79,0xe7,0x9c,0xf1,0x4e,0xbb,
|
||||
0x10,0x39,0xad,0x27,0x72,0x53,0x25,0xcf,0xa3,0x01,0x5d,0x7f,0x9b,0x1f,0x97,0xd3,
|
||||
0xa0,0xe5,0x3b,0x3a,0x63,0xd9,0x93,0x4e,0x2a,0xaf,0xff,0x9e,0x24,0x82,0xe7,0x66,
|
||||
0x1b,0x77,0x50,0xe7,0x7d,0xd5,0x20,0xcf,0x53,0xd5,0xb7,0xda,0xbd,0x2f,0x0b,0xeb,
|
||||
0x09,0x3f,0xd1,0x3a,0xce,0x3a,0x75,0xdf,0x21,0x73,0x52,0xea,0xcd,0xab,0xd7,0xff,
|
||||
0xd6,0x6a,0x3b,0xcf,0x2d,0xd7,0x97,0x2a,0xc5,0x3c,0xed,0x3a,0xad,0xf3,0x87,0xa4,
|
||||
0xae,0x03,0xba,0xfa,0xdf,0xfb,0xf2,0x8e,0x35,0xd1,0x7d,0x13,0x07,0x67,0xa9,0x27,
|
||||
0x7d,0xaa,0xf5,0xc4,0xb5,0xea,0xaf,0x93,0xb2,0xb9,0xe4,0xfa,0xdf,0x4f,0xb5,0xee,
|
||||
0x17,0xca,0x6e,0x6d,0xe3,0x9e,0x36,0xee,0x5a,0x63,0x5f,0xc1,0xb2,0xbf,0x90,0x23,
|
||||
0xe6,0x5c,0x70,0xd1,0x6c,0x4a,0x5d,0x86,0x2b,0xa6,0xbb,0xa0,0xed,0x9b,0xbb,0x8e,
|
||||
0x9b,0x6e,0xff,0xfe,0x35,0xaa,0xc7,0xff,0x87,0xfc,0x83,0xfc,0x54,0x7e,0x2f,0x19,
|
||||
0xdf,0x7a,0xad,0x95,0x40,0x0a,0x8f,0x6b,0x43,0x6c,0xbe,0x89,0xa8,0xee,0x9a,0xac,
|
||||
0xff,0xfd,0x56,0xfe,0x51,0xfe,0x4b,0x96,0xcb,0x46,0xd9,0x25,0x07,0x16,0x68,0xec,
|
||||
0x48,0xae,0xde,0x76,0xd5,0xfb,0xad,0x23,0xaa,0x77,0x2d,0xb5,0xf3,0xaa,0x4f,0x7a,
|
||||
0x7d,0x1f,0xf7,0x19,0x75,0x76,0x76,0xcb,0x92,0x4e,0xc2,0x7f,0xd5,0x41,0x67,0x8a,
|
||||
0x7b,0x6c,0xe3,0xd7,0x94,0x1e,0xcc,0x78,0xfd,0xef,0x7f,0xdb,0xdf,0x69,0xfd,0xc1,
|
||||
0xf5,0x05,0x5e,0xd5,0xbf,0x83,0xaf,0x7e,0xfd,0xef,0x33,0xfb,0xd9,0x9c,0xd7,0xf3,
|
||||
0x7b,0x0a,0xae,0x45,0x7d,0x66,0x4b,0xd9,0x8e,0x9e,0xc8,0x7f,0x19,0x71,0xe3,0xd8,
|
||||
0x76,0xda,0xa2,0xd7,0x0e,0xfd,0xb5,0xc7,0x15,0x6a,0x87,0x03,0xe6,0xbc,0xd6,0x15,
|
||||
0x5f,0xf5,0xfa,0x5f,0xbc,0x0c,0x07,0x7c,0x9b,0xb5,0xd6,0x9c,0xf0,0x7d,0x2a,0x69,
|
||||
0xcb,0xd0,0x6e,0x6e,0x05,0xd3,0xc7,0xdb,0x25,0xf7,0xf9,0xdc,0xd7,0x71,0x3f,0x50,
|
||||
0xf7,0xbd,0x23,0x9f,0x24,0x7a,0x62,0x92,0xc7,0xd5,0xda,0xff,0x8e,0x2d,0x6f,0x4b,
|
||||
0xe1,0x75,0x5d,0xbf,0xcf,0x9d,0xff,0xfe,0x8f,0xba,0x79,0x83,0xec,0x2c,0xc1,0x7f,
|
||||
0x47,0x7c,0xfb,0xb4,0xc1,0xb7,0x4d,0xa7,0xda,0xa4,0x43,0x0b,0xf0,0x7d,0xbe,0x6f,
|
||||
0xee,0x7b,0x1e,0x98,0x87,0xe1,0x43,0xcf,0xa3,0xf0,0xbb,0xcc,0x77,0x9e,0xc9,0xcc,
|
||||
0xf7,0xe1,0xf7,0x33,0xf2,0x7c,0xa6,0x31,0x4b,0xe1,0xf3,0x82,0xe9,0x9e,0xfa,0xe5,
|
||||
0x3c,0x72,0xcb,0xd5,0xe5,0xbb,0xf5,0x8c,0xa6,0xae,0x63,0xdc,0xd4,0x6d,0x7c,0x62,
|
||||
0xf1,0x5f,0xf5,0x91,0xe6,0x9e,0xdc,0x78,0xbf,0xe9,0xa8,0x9f,0xbe,0xb0,0x9f,0xf0,
|
||||
0x2d,0xfb,0x91,0x6c,0xd7,0xba,0xc9,0x55,0xd3,0xe3,0xc7,0xc1,0x2d,0x44,0xff,0xef,
|
||||
0x9c,0xa5,0xb2,0x85,0x7d,0x91,0xa5,0x6c,0x47,0xa7,0xf7,0xdf,0x7b,0x76,0x8d,0xfe,
|
||||
0x77,0x87,0xfc,0x29,0xd6,0xaf,0xf9,0x27,0x73,0x3a,0xf1,0xf3,0x8f,0x66,0x87,0x4e,
|
||||
0xb3,0x56,0xeb,0x89,0x8d,0x72,0xc3,0x1c,0x29,0x7a,0xef,0xf3,0x5a,0x49,0xd3,0xff,
|
||||
0x1b,0x2f,0x83,0xeb,0xb3,0xb5,0xf2,0x85,0xbb,0xae,0x56,0x52,0x19,0xfa,0x63,0xf7,
|
||||
0x6c,0xe4,0xee,0x8d,0x28,0xb5,0x1f,0xbf,0x48,0x0f,0x71,0xac,0xfc,0x2d,0xd3,0xfa,
|
||||
0x9f,0x93,0xeb,0x70,0xfb,0xfc,0xb7,0x5a,0x87,0x2c,0xee,0xbf,0xc3,0xde,0x73,0xe7,
|
||||
0xa3,0xba,0x5c,0x87,0xaf,0xc7,0xcd,0x77,0x9c,0xf4,0x3d,0xef,0xb5,0xb1,0x8c,0x73,
|
||||
0xda,0x44,0x90,0x75,0xda,0xb3,0xc8,0x4d,0x3f,0x94,0x30,0xee,0x71,0xc1,0xd1,0xf5,
|
||||
0x3f,0xd3,0xb2,0x3c,0xd6,0x72,0x8d,0xcd,0xe6,0x44,0xfc,0xb7,0x24,0xc6,0xff,0xcd,
|
||||
0x45,0x8f,0x3f,0xaf,0x62,0xe3,0xc4,0xfc,0x3d,0x09,0x3f,0xb3,0x9f,0xc8,0x2e,0x53,
|
||||
0xaf,0x75,0xbf,0x81,0x69,0xcb,0x7c,0xf2,0xea,0xe3,0xff,0xe6,0x1c,0x8b,0xd6,0x53,
|
||||
0xf2,0x76,0xb4,0x79,0xff,0x2d,0xb7,0x6e,0x0c,0xef,0x8b,0xc4,0xb2,0x5c,0x3f,0xc0,
|
||||
0x97,0x89,0x75,0xbf,0xf0,0xbf,0xcb,0x48,0x5d,0xd0,0x62,0xdc,0x3d,0x63,0x7d,0xea,
|
||||
0xb6,0xcb,0x72,0xca,0x1c,0xd0,0xf6,0xe8,0x56,0xd9,0x68,0x36,0xca,0x46,0xbb,0x51,
|
||||
0x42,0x5b,0xea,0xf8,0xbf,0x2f,0xb5,0x0c,0x2b,0xb4,0xad,0x5f,0x4a,0x19,0x0e,0x4b,
|
||||
0xa3,0xbd,0xa4,0x6d,0xe0,0x0b,0xfa,0x5f,0x77,0xff,0xd7,0x37,0x91,0x6b,0xe6,0xb3,
|
||||
0xfd,0xc9,0xe3,0xb8,0x69,0x1e,0xe3,0xff,0x72,0xf5,0xbf,0x8d,0xda,0xf2,0xaf,0xb3,
|
||||
0x8d,0x5a,0x9f,0x6b,0x89,0xee,0x03,0xeb,0x2f,0xf9,0xbb,0x78,0x2f,0x5f,0x6f,0x7b,
|
||||
0x9c,0xa8,0xaf,0xfd,0x50,0x59,0xbf,0xcd,0x83,0xef,0xc3,0x67,0x5a,0xfe,0x89,0xcc,
|
||||
0x98,0x6e,0x13,0xfe,0xab,0x7e,0xff,0x95,0x72,0x6c,0xfd,0xbd,0x09,0xf1,0xfb,0x3f,
|
||||
0xfc,0xbd,0xba,0xd3,0xfd,0x37,0x35,0xcf,0xd8,0x3c,0xef,0xff,0xf8,0xc1,0x94,0x7a,
|
||||
0x8f,0x49,0xa9,0xdb,0xf1,0x91,0xbb,0xfe,0x56,0x70,0x9f,0xc9,0xee,0xe8,0xf7,0xbb,
|
||||
0xc3,0xd8,0xfa,0xf5,0x5c,0xfc,0x42,0x7f,0x6f,0xe4,0xb4,0x69,0x55,0xd7,0xf6,0x4a,
|
||||
0xb7,0xfe,0xf7,0x82,0xd6,0xd1,0x8e,0x9a,0x5a,0xd9,0xaf,0x75,0xad,0x7d,0x76,0x9f,
|
||||
0xec,0x2d,0xf1,0xfe,0x0f,0xb7,0x5f,0x56,0xc8,0x72,0x5d,0x6e,0x29,0x65,0x58,0xa5,
|
||||
0xad,0xe0,0xed,0xf2,0xb5,0xd6,0xb6,0x6a,0x35,0x53,0x75,0xad,0x52,0xb7,0xbf,0x65,
|
||||
0xda,0x71,0xdc,0x38,0x8f,0xfb,0x3f,0x7e,0x25,0x6f,0xfb,0xfb,0x48,0x9a,0xd4,0x79,
|
||||
0xe9,0xda,0xaf,0xae,0xdd,0x38,0x16,0xb8,0xb6,0xe9,0x13,0x5f,0x87,0x73,0x8e,0x7b,
|
||||
0xb1,0x04,0x1d,0x57,0x4a,0xfd,0x70,0x32,0x7c,0x9c,0x79,0x18,0xe0,0xbf,0x6a,0xf5,
|
||||
0x5f,0xea,0xfb,0x6c,0x6b,0xfa,0xbd,0x67,0x12,0xf7,0xff,0x16,0xf1,0xdf,0xd4,0x3c,
|
||||
0x77,0x32,0xf3,0xbb,0xff,0x77,0x32,0xf5,0xf4,0xfd,0xc1,0xea,0x12,0xb7,0x63,0x32,
|
||||
0xb3,0x41,0xb2,0xcf,0x80,0x19,0x4f,0xdc,0x17,0xbb,0xdf,0xb8,0x9e,0x86,0x9f,0xca,
|
||||
0xa7,0xfa,0xd9,0xfe,0xc4,0xbd,0xb7,0xe3,0x81,0xbb,0x4e,0xba,0x4e,0xea,0xa5,0xd5,
|
||||
0x74,0xa9,0x03,0x3b,0xf5,0xbf,0x97,0xb5,0x5d,0xd8,0x20,0xf5,0xba,0xdd,0x8e,0x33,
|
||||
0x66,0x73,0x29,0xf7,0xff,0x86,0xae,0x9f,0x7c,0x85,0xcc,0x5c,0x86,0x8f,0xe5,0x7f,
|
||||
0x8a,0x33,0xe0,0x4c,0x65,0x58,0x2d,0xa1,0x37,0xe0,0xfe,0x84,0x01,0x4b,0xdd,0x7e,
|
||||
0x7f,0x2f,0x71,0xe2,0x38,0x6e,0x98,0xc7,0xfd,0xbf,0x6f,0xdb,0x77,0xc5,0xea,0xdf,
|
||||
0x80,0x8b,0xa6,0x3b,0x18,0x9e,0xd6,0x5e,0x1d,0xcb,0x5f,0x7f,0x73,0xf5,0xb8,0x97,
|
||||
0xaf,0xaf,0xe3,0xd2,0x10,0x3c,0x31,0xf8,0xaf,0x3a,0xfd,0x97,0xf6,0xd9,0x2f,0xd9,
|
||||
0xe7,0x86,0x7c,0x28,0x89,0xe7,0xbf,0xf8,0xe7,0x61,0xfd,0xc2,0xae,0x94,0xdd,0xe6,
|
||||
0xac,0xb4,0xe7,0xfd,0x37,0xf5,0xbc,0x91,0x81,0xf5,0xab,0xbd,0x4f,0x4a,0x7c,0xfe,
|
||||
0x4b,0x38,0x9e,0xf2,0x19,0x33,0x75,0x99,0xdc,0xb5,0xa9,0xb4,0xdb,0x31,0x10,0xee,
|
||||
0xf5,0xf3,0xec,0x0d,0x47,0x13,0xcf,0x8b,0x39,0xa4,0xdb,0xb7,0x52,0xcf,0xe9,0x9f,
|
||||
0xca,0xbb,0xd6,0x8d,0xa8,0x3e,0x94,0x78,0xf6,0xca,0xe8,0xfa,0xbd,0xea,0xb7,0xdd,
|
||||
0x7a,0xae,0xbb,0x7b,0xfe,0x6f,0x4a,0xaf,0xe9,0xd6,0x76,0x70,0x7b,0xd0,0xae,0x6d,
|
||||
0xc9,0x36,0xa5,0xdd,0x5c,0x4c,0xfb,0xfc,0x97,0x0d,0x6d,0xfe,0xd9,0x2f,0x1f,0x15,
|
||||
0x29,0xc3,0x72,0x6d,0x55,0xfe,0x0f,0xf9,0x89,0xb7,0xe3,0x4c,0x65,0x58,0x2b,0x9b,
|
||||
0x65,0xa7,0xec,0xd5,0x36,0x67,0xd2,0x7f,0x69,0xb7,0xdf,0xd1,0x54,0xf8,0x1c,0x9f,
|
||||
0xb0,0xc6,0xef,0x93,0x52,0x9e,0xff,0xf2,0x81,0xbc,0x65,0x3f,0x94,0x2d,0xa6,0x2e,
|
||||
0x68,0x35,0x83,0x7a,0xbc,0x72,0xf5,0xb9,0x37,0xda,0x73,0xf8,0xef,0xb5,0xeb,0xff,
|
||||
0x88,0xe7,0x37,0xf2,0xfe,0xb4,0xe9,0x3f,0x91,0xdf,0xda,0x8c,0xb6,0x03,0xcf,0xcb,
|
||||
0x0d,0xef,0xbf,0xe9,0xcb,0xfc,0x83,0xd6,0x0f,0xe7,0x73,0x3d,0x3e,0x75,0xa9,0xec,
|
||||
0xc7,0x25,0xce,0xb1,0x22,0xba,0x67,0xae,0x30,0xbf,0x96,0x9f,0xdb,0xf7,0x64,0xb9,
|
||||
0xef,0x93,0x98,0xfe,0xe9,0x1a,0x71,0xf7,0x4b,0x5c,0xd7,0xfa,0x5f,0xbf,0x0c,0x9a,
|
||||
0xc1,0x60,0x40,0xb7,0x37,0x4e,0xab,0xc9,0xa4,0x2e,0xc1,0x47,0xf2,0x4f,0xae,0xf5,
|
||||
0x3b,0xc3,0xbd,0x2c,0xff,0xaa,0xb5,0xbf,0x7f,0xd6,0x5a,0xe8,0x6f,0x8a,0xdc,0xeb,
|
||||
0xb2,0x22,0xaa,0x01,0x1e,0x88,0xf9,0x4f,0x16,0x60,0x2f,0xae,0x91,0x75,0x25,0x1c,
|
||||
0xa3,0x3f,0xd8,0x5f,0x07,0x1f,0x9b,0x8d,0xe1,0x11,0xd3,0x12,0x0e,0x67,0x1e,0xd5,
|
||||
0x3c,0xc7,0x71,0x55,0xea,0xbf,0x46,0xb9,0x68,0xaf,0xeb,0xb9,0x79,0x53,0x86,0x71,
|
||||
0xde,0x3c,0xc6,0xbf,0xe4,0xf2,0xa9,0xbc,0x67,0xdf,0x91,0xdf,0xdb,0x35,0x89,0xb1,
|
||||
0x26,0x2b,0xf5,0x4c,0x5e,0x65,0xb6,0xc8,0x51,0xad,0xff,0x74,0xa9,0x13,0xa6,0x2f,
|
||||
0x73,0xb9,0x9e,0x2b,0xab,0x44,0x9c,0x1b,0x6c,0x5a,0x37,0xad,0x49,0x7d,0x1e,0x7e,
|
||||
0xaa,0xbe,0x7a,0xc7,0xfe,0xa1,0x04,0xbf,0xae,0x90,0x3f,0xda,0x5f,0xcb,0x07,0x5a,
|
||||
0xa6,0xc2,0xb5,0xfc,0xd1,0xfe,0x4e,0x59,0xab,0x75,0x1a,0x6d,0x5d,0x16,0x3c,0x4f,
|
||||
0x79,0x95,0xa6,0xc6,0xee,0x95,0x6f,0xcd,0x55,0xe9,0x56,0xd7,0x25,0xfb,0x60,0x6f,
|
||||
0xcb,0x4d,0xd3,0x23,0xd7,0xcc,0x05,0x6d,0xcf,0xda,0xb9,0xdd,0x21,0xbf,0x52,0xc3,
|
||||
0xfd,0x8b,0xbc,0xa5,0x2d,0xdd,0x55,0x89,0x4f,0xdc,0xa8,0xe4,0x7f,0x93,0xff,0x90,
|
||||
0xb7,0xe5,0x7d,0xdd,0xdf,0xeb,0x7c,0xaf,0x72,0x7c,0x5f,0xff,0x51,0xad,0xf8,0x89,
|
||||
0x58,0xf9,0x5c,0xbe,0x4a,0xb4,0x80,0xf7,0x96,0x68,0x40,0xb7,0x8f,0xd7,0x26,0x8e,
|
||||
0xe3,0x1a,0xbb,0x5e,0x02,0x5b,0xa3,0xf5,0xf4,0xb9,0xe7,0x5e,0xa9,0x7f,0x6f,0xfe,
|
||||
0x68,0x56,0x05,0x35,0x66,0x5f,0x78,0xce,0x74,0x87,0xf7,0xb4,0x4d,0xfc,0xa2,0x4a,
|
||||
0xae,0xb7,0xfd,0x90,0x1f,0xb3,0xf2,0x2c,0x3f,0xf6,0xe5,0x71,0x26,0x37,0x1e,0x66,
|
||||
0x3c,0x3f,0x46,0xa6,0x90,0x7b,0x45,0xaf,0x57,0xc6,0x79,0x18,0x3c,0xd4,0x65,0x7d,
|
||||
0x97,0xbf,0x76,0xf9,0x7c,0x09,0xf8,0x6f,0xa6,0xe7,0x15,0x36,0xcb,0x75,0x6d,0xbf,
|
||||
0xdc,0xc4,0x81,0xfe,0xde,0xd1,0x5e,0xd3,0x1a,0x34,0x98,0x5a,0xf9,0x42,0xcf,0xf9,
|
||||
0xcf,0xcc,0x1a,0x3d,0x17,0x92,0xb8,0xeb,0xee,0xab,0xcc,0x4a,0x65,0x9d,0x84,0x66,
|
||||
0x87,0x1f,0xb3,0x76,0x5a,0xd9,0xaf,0x75,0xbd,0x1a,0x9d,0x67,0xab,0xd9,0x27,0xf5,
|
||||
0xa6,0x45,0x97,0x33,0x1c,0x5b,0x66,0x8b,0xfe,0x6e,0x9f,0x7e,0x16,0xea,0x3c,0x5b,
|
||||
0x65,0x8f,0x39,0x26,0x27,0x95,0xfd,0x66,0xbb,0xfe,0xbc,0x4e,0x97,0xb5,0xca,0xdf,
|
||||
0x13,0x56,0xb8,0xae,0x35,0x7a,0x5e,0x66,0xec,0x46,0xd9,0x6e,0xf6,0xe8,0x7a,0x0e,
|
||||
0xca,0x57,0xe6,0x73,0x9d,0xfe,0x33,0x59,0x33,0xad,0x5c,0xab,0xfd,0x32,0x56,0x2a,
|
||||
0xeb,0x74,0x1d,0x3b,0x74,0xda,0xe3,0xe6,0x94,0xb2,0x6f,0x8e,0xed,0xc8,0xfa,0xd5,
|
||||
0x18,0x77,0xef,0xfe,0x71,0x39,0xa3,0xed,0xf6,0x93,0x3a,0xef,0x76,0x9d,0x27,0xa3,
|
||||
0x8e,0xde,0x68,0x77,0xca,0x37,0xa6,0x21,0xb8,0x62,0xae,0x29,0x0d,0xfa,0xef,0x9d,
|
||||
0xb2,0x51,0x7f,0x9f,0xb1,0x5a,0xeb,0xd2,0x7d,0x54,0x6f,0xdc,0x33,0x9f,0x5a,0xa4,
|
||||
0xc5,0x3f,0xa7,0xee,0x9c,0x7e,0x9f,0xea,0x62,0xf7,0x40,0x1d,0x54,0x13,0xed,0xd4,
|
||||
0xf6,0xe9,0x7a,0xfd,0xab,0xf0,0x1b,0xf9,0x85,0x7a,0xec,0x2d,0x9f,0x9f,0xe9,0xbf,
|
||||
0xb2,0xf9,0x59,0xf4,0x9b,0xb7,0xf5,0xd3,0xf7,0xd5,0x65,0x9f,0xc9,0x06,0x9d,0x7e,
|
||||
0xa3,0x18,0xb5,0xdb,0xef,0xb4,0xfe,0xf9,0x0b,0xcd,0xbb,0x6a,0x48,0x77,0x9d,0x6f,
|
||||
0xab,0x6c,0x53,0x42,0x6f,0xcc,0x77,0xfd,0x27,0xbf,0xd6,0x69,0x56,0xaa,0xeb,0xb2,
|
||||
0xfe,0x9b,0x6a,0x01,0x1f,0xf7,0xe3,0x86,0x4f,0x5b,0xdd,0xbf,0xf6,0x0b,0xf5,0x98,
|
||||
0xdb,0xbf,0xcb,0x75,0x3b,0x57,0xce,0xb2,0x8f,0x37,0xe9,0x3e,0xab,0x0d,0xea,0xcc,
|
||||
0xc9,0xe0,0xb0,0xd9,0x1b,0xec,0x32,0x3b,0x83,0x7d,0xe6,0x68,0xd8,0x68,0x2e,0x87,
|
||||
0x4d,0x99,0xd3,0xe1,0x41,0xf3,0x65,0xb8,0xd1,0xe8,0xa2,0x8c,0x09,0x8c,0x62,0x8d,
|
||||
0x0d,0xc4,0x84,0x41,0x18,0xb1,0xd9,0xec,0x08,0x6b,0xcd,0xd9,0xb0,0xdd,0xdc,0x0e,
|
||||
0x27,0x16,0xe7,0xfa,0x5e,0x34,0x26,0xef,0xa9,0xf7,0xcf,0x93,0xac,0xd3,0xa2,0xb1,
|
||||
0x78,0xf7,0x2b,0x7a,0x0e,0xdd,0xd5,0xf5,0x3f,0xcc,0xb8,0x71,0x39,0x93,0xae,0x3f,
|
||||
0xa7,0xaa,0xfd,0x37,0xc3,0x68,0x4c,0x3f,0x16,0xb3,0xc5,0xb6,0xaa,0x0f,0x07,0xde,
|
||||
0x40,0xff,0xdd,0x0e,0xfa,0xb5,0xce,0x76,0xc5,0xd4,0x6b,0x1d,0x6e,0xbf,0xec,0x36,
|
||||
0xbb,0x64,0x57,0x11,0x76,0xab,0x5b,0x0e,0x9b,0x93,0x72,0xde,0x5c,0x56,0x37,0x5c,
|
||||
0x92,0xb3,0xea,0x8f,0xc3,0xe6,0x90,0x1c,0xf3,0xf7,0x70,0x65,0xef,0xc9,0x9f,0xbe,
|
||||
0x4c,0x3d,0x47,0xd5,0x7b,0xf5,0xe6,0x42,0x70,0x59,0xeb,0x88,0x0d,0x3a,0xff,0x21,
|
||||
0xb3,0x77,0xd6,0xf5,0x7c,0xad,0xf3,0x1c,0xf5,0xf7,0x92,0xd4,0xcb,0x09,0x73,0x58,
|
||||
0x9d,0xb9,0xbb,0xe8,0xb4,0xbb,0xf4,0xb3,0x7d,0x3a,0x8d,0x7b,0x2e,0xde,0x25,0x2d,
|
||||
0x57,0xb6,0x5f,0x76,0xf6,0xed,0xf8,0xca,0x7c,0x2d,0x07,0x7d,0x99,0x2e,0x6a,0x19,
|
||||
0xaf,0x04,0x4d,0xbe,0x9c,0x07,0x74,0x39,0xfb,0xe5,0x88,0xce,0x7f,0xd1,0xb4,0xba,
|
||||
0x3e,0x5e,0xf5,0x5c,0x83,0xfe,0xfe,0x6b,0xd9,0xac,0xee,0x5b,0x67,0x3f,0x93,0xf5,
|
||||
0x5a,0xb7,0xdb,0x2c,0x3b,0xa6,0xf5,0x3e,0x4c,0xa5,0x56,0x5b,0xa5,0x7b,0x74,0x8a,
|
||||
0x2d,0xea,0xa8,0xb5,0x5a,0xf3,0xd5,0x7a,0x52,0x91,0x7c,0xac,0x75,0xb0,0x75,0x3a,
|
||||
0xd5,0x66,0x6d,0xcb,0x7e,0xa9,0x9e,0xdb,0xa4,0xb5,0xba,0xb5,0xfa,0xbb,0x4f,0x75,
|
||||
0x2e,0xb5,0xb3,0xfe,0xbc,0x5d,0x1d,0xf7,0xb5,0xb2,0x5d,0xff,0x6d,0xf4,0x77,0xcb,
|
||||
0xf5,0xb3,0x15,0x3a,0xcd,0x46,0xd9,0x69,0xbf,0x51,0xd7,0x5d,0xf2,0xcf,0xd8,0xbc,
|
||||
0x69,0x86,0x24,0xdd,0x71,0xdc,0xad,0xfb,0x75,0xaf,0x3a,0xee,0x40,0x70,0xd0,0x1c,
|
||||
0x0a,0xf4,0x98,0x85,0x97,0x32,0xd7,0xc3,0x1b,0xa6,0x23,0x6c,0x31,0x17,0xc2,0x06,
|
||||
0x75,0x59,0xa3,0xb9,0x1a,0x76,0x9a,0xde,0xb0,0x27,0xd3,0x1e,0x36,0xeb,0xcf,0x27,
|
||||
0xcd,0xf1,0xf0,0xa8,0x3a,0x71,0x3a,0xc7,0xf5,0xb3,0xb3,0x3a,0x4d,0xa7,0xb6,0x7d,
|
||||
0xc7,0xc3,0xa7,0x5a,0x0f,0x7a,0xb9,0x40,0x63,0x47,0x22,0xbf,0x05,0x8f,0x32,0x51,
|
||||
0x7d,0x2d,0xe3,0xfc,0xb6,0xd4,0xce,0x29,0xd7,0xff,0xe3,0xfa,0xb8,0x9f,0x86,0xcf,
|
||||
0xab,0xdc,0x7f,0xd3,0xe3,0xfe,0x96,0x66,0xdb,0xcc,0x1d,0x45,0xef,0x8b,0x7e,0x9d,
|
||||
0x18,0x09,0x86,0xfc,0x98,0xb6,0x16,0x3d,0xef,0xcf,0xab,0xd3,0xea,0xf3,0x7d,0x9a,
|
||||
0x85,0x9c,0xd5,0xcf,0x2f,0x9a,0x96,0xa0,0x5d,0xcf,0xb3,0x2e,0xff,0x1c,0x4b,0xe7,
|
||||
0x9b,0x0b,0xea,0x9d,0x16,0x9d,0xbf,0x4f,0x97,0x33,0x32,0x6d,0x99,0x97,0x4c,0x53,
|
||||
0xe0,0xee,0x2f,0x6d,0x31,0x1d,0xfa,0xb3,0xeb,0x37,0xbd,0x2a,0x17,0xe6,0x58,0x4f,
|
||||
0x83,0x69,0xd4,0xf9,0xae,0x04,0x2d,0xba,0xae,0x66,0x75,0xd4,0x79,0xad,0xa3,0xd5,
|
||||
0x17,0x9d,0xfe,0xac,0x7e,0x7e,0x51,0x97,0xdf,0xee,0x97,0xdf,0x9e,0x62,0x3b,0xce,
|
||||
0x68,0xfd,0xae,0x49,0xcb,0x7e,0xdd,0x97,0xe9,0x8a,0x4e,0x5f,0xaf,0xde,0x3b,0x24,
|
||||
0xbb,0xad,0xfa,0x46,0xd9,0x6b,0xf7,0xa8,0xe1,0x0e,0x28,0x7b,0xb4,0x36,0xb7,0x4d,
|
||||
0x1d,0xb5,0x41,0x6b,0x61,0x35,0x6a,0x9e,0xad,0xea,0xaa,0xaf,0x0a,0xfa,0x1e,0x92,
|
||||
0xfe,0xab,0xf5,0x73,0xed,0x92,0x2f,0xd4,0x81,0x6e,0xae,0x62,0xff,0x0b,0x75,0x69,
|
||||
0x5b,0xd4,0x6d,0x3b,0x65,0xb7,0xc6,0x59,0x6e,0xab,0xfe,0xa6,0x46,0x7f,0xef,0xea,
|
||||
0x83,0xdb,0xf4,0xf7,0xae,0x0c,0x75,0x72,0xcc,0x9e,0x96,0x3a,0x7b,0x52,0xff,0xc6,
|
||||
0xd4,0xc9,0x09,0xdb,0xa0,0xfb,0xf2,0x8a,0xb4,0x99,0x6e,0x75,0x5d,0xe1,0x33,0x58,
|
||||
0xe3,0xc7,0xf1,0x42,0x70,0xde,0x34,0xea,0x36,0x5e,0xd4,0xbf,0x39,0x57,0xc2,0xab,
|
||||
0xe6,0x7a,0xd8,0x9a,0x69,0x8d,0xd1,0x16,0xb6,0x67,0xba,0xc3,0xbe,0xcc,0x50,0x38,
|
||||
0x92,0x19,0x09,0x07,0x33,0x37,0xd5,0x79,0xdd,0xe1,0xcd,0xcc,0x40,0xa8,0xe7,0x6e,
|
||||
0xcd,0x5d,0xfd,0xdd,0x40,0xa6,0x27,0xbc,0xa1,0xd3,0x25,0xe7,0x9b,0x9a,0xff,0x86,
|
||||
0xe9,0xd1,0x69,0x46,0x6b,0x1e,0x9a,0xc9,0x9a,0xef,0x33,0x2f,0x4b,0x70,0xdc,0x4b,
|
||||
0xdf,0x3e,0x9d,0xf4,0x6d,0xc8,0x09,0xad,0x37,0x65,0xdb,0xa4,0xa3,0xaf,0xf1,0x39,
|
||||
0x76,0x5f,0x3d,0x5e,0xb9,0xf1,0x2f,0x0b,0x71,0x5f,0xe2,0x09,0x75,0xe2,0x59,0x6d,
|
||||
0xef,0x5c,0xf4,0xf7,0x5c,0xf7,0x2e,0xd0,0xfd,0x3a,0xd5,0xe2,0xbf,0xdb,0x66,0x48,
|
||||
0xcf,0xa7,0x5e,0x75,0xda,0x8d,0x7c,0x7f,0xe6,0x74,0xda,0xbd,0xf7,0xba,0x75,0xba,
|
||||
0x5b,0xfe,0x7a,0x7f,0x7f,0xd4,0x07,0xea,0x5c,0x58,0xf8,0x2e,0x89,0xf8,0x32,0x3b,
|
||||
0x75,0x9a,0x2e,0xf7,0xae,0x08,0x9d,0xa6,0x5f,0xe7,0xcd,0xad,0xa7,0x7d,0xd6,0xf5,
|
||||
0x74,0x99,0x1e,0x9d,0xa7,0x37,0xe8,0xd6,0x7f,0xdf,0x28,0x3a,0xad,0xeb,0x77,0x75,
|
||||
0xde,0xeb,0x8e,0x2f,0x3f,0x98,0x79,0x3b,0xae,0x38,0x17,0xab,0xff,0xce,0x68,0x1b,
|
||||
0xf9,0x78,0xf6,0xb9,0xea,0x76,0xaf,0xba,0x6c,0x8f,0xaf,0x65,0xed,0xd4,0x5a,0xdb,
|
||||
0x0e,0xfd,0xff,0xaf,0xf4,0xe7,0x7d,0xde,0x6f,0x2e,0x07,0xf5,0xdf,0x7b,0x12,0x9f,
|
||||
0xaa,0x1d,0xd5,0x8c,0xc5,0xfc,0x77,0x28,0x9a,0x6b,0x7f,0x6c,0xae,0x1d,0xea,0xcc,
|
||||
0x64,0xb2,0xbf,0xd5,0xfa,0xb4,0x5f,0xd7,0x7e,0xcd,0x5e,0xd9,0xe7,0xcb,0x73,0x5c,
|
||||
0x5d,0xd7,0x20,0x8d,0x5a,0xde,0x1b,0xd1,0xfb,0x89,0x6e,0x9b,0x61,0xdd,0xae,0x9b,
|
||||
0x7e,0x3f,0x74,0x78,0x5f,0xbb,0x6d,0xed,0x57,0xd7,0xe5,0xee,0x01,0x76,0x75,0x8d,
|
||||
0x71,0x3f,0xd6,0xe4,0x51,0xe6,0x89,0xb6,0x45,0x1f,0x86,0x63,0x99,0x7b,0x35,0xa3,
|
||||
0x99,0x3b,0x35,0x7a,0x2c,0x8a,0x30,0xaa,0x8e,0xbb,0x1f,0x8e,0x67,0x1e,0xd6,0x4c,
|
||||
0x98,0x09,0x75,0xd8,0x58,0xa8,0xf5,0x2c,0x9d,0xef,0x61,0xcd,0xe3,0xcc,0x77,0x35,
|
||||
0xdf,0x65,0x1e,0xd7,0x3c,0xcc,0x8c,0x85,0xf7,0xd4,0x6f,0xa3,0x33,0xcc,0x3f,0xaa,
|
||||
0xf3,0xdf,0xd3,0xcf,0x27,0x74,0x7d,0xcf,0x8a,0xd7,0xfd,0xbc,0xe7,0x5c,0x5b,0x55,
|
||||
0xeb,0x72,0xc1,0xf8,0x92,0xac,0xc7,0x2d,0xdc,0x7d,0xf6,0x4b,0xdb,0x7f,0x45,0xda,
|
||||
0xce,0xfe,0x79,0x14,0x4d,0xd1,0xb8,0xf7,0x1b,0xda,0x16,0xe9,0x5b,0x92,0xef,0x05,
|
||||
0x1c,0xc9,0x9e,0x67,0xc1,0x60,0x41,0x7f,0xe6,0x74,0x06,0x83,0xec,0x7b,0xc3,0x6e,
|
||||
0x7b,0x86,0xd5,0x71,0xae,0x1f,0x74,0x70,0xda,0xbb,0xc4,0xe2,0xcb,0x1c,0xf4,0x0c,
|
||||
0x47,0xf3,0xb8,0xdf,0x0d,0xcd,0xb9,0x9e,0x01,0x9d,0xc7,0xbd,0xe7,0xcc,0x4d,0x3b,
|
||||
0x98,0x72,0xda,0xdc,0xf2,0x7b,0xd4,0x11,0x1d,0xd2,0x6c,0x9a,0xe5,0x9c,0xd6,0x0d,
|
||||
0xdd,0x35,0xb1,0x63,0x76,0xbf,0x4c,0x8f,0xb3,0x58,0x36,0x07,0x0a,0x7e,0x5b,0x1b,
|
||||
0xb5,0x6e,0x73,0x0e,0x2c,0xf6,0x79,0x71,0x03,0xd6,0xfa,0xe5,0xee,0x2f,0x92,0x23,
|
||||
0x72,0x4c,0xbe,0x55,0xcf,0x5d,0xd6,0xef,0x4d,0x87,0x96,0xf7,0x56,0x62,0x3b,0x73,
|
||||
0xfb,0x38,0xbb,0x3f,0x73,0xfb,0x31,0xfb,0xb9,0xfb,0xfd,0xdd,0xf0,0xbe,0x99,0x08,
|
||||
0x1f,0x6b,0xdb,0xea,0x59,0x41,0xbd,0xeb,0xa5,0xfe,0xfc,0xdc,0xdf,0x7f,0xf0,0xb4,
|
||||
0xe6,0xe9,0x9c,0xf8,0xfb,0xc7,0x6a,0xb2,0x3c,0xd3,0x79,0x1c,0xee,0xdf,0xcf,0x6b,
|
||||
0x5e,0x28,0xd9,0x7b,0x5e,0x67,0x9b,0x3f,0x7b,0xfd,0xdf,0xad,0xf3,0xa5,0xff,0xb7,
|
||||
0xaf,0xcf,0x45,0xf7,0x81,0xdd,0xe3,0xba,0xfa,0x1b,0xe0,0xbf,0xa2,0xcf,0xfc,0x97,
|
||||
0xec,0xfb,0xf2,0x2e,0xfa,0xfb,0xbb,0x7b,0xdd,0x35,0x1a,0xbe,0x03,0x0b,0xf8,0x5d,
|
||||
0x1a,0xf0,0xf7,0x92,0x76,0xf8,0xba,0xb8,0xab,0xd3,0x35,0xd9,0x7a,0x7f,0xaf,0xe9,
|
||||
0x37,0x55,0xf7,0x8c,0xf5,0x6f,0xb4,0x5c,0xa7,0xfd,0xf3,0x4c,0x72,0xed,0x86,0xf4,
|
||||
0xef,0x4a,0x8b,0xfa,0x1b,0xcd,0x93,0xe8,0x5e,0xd7,0x97,0x55,0xd0,0xbf,0xfa,0x32,
|
||||
0x5f,0xa7,0xd3,0x7a,0x66,0x30,0xa6,0x75,0xba,0xbb,0x7c,0x1f,0xab,0xdc,0x7f,0xad,
|
||||
0xd2,0xa2,0xdf,0xbf,0xb3,0x55,0xf0,0x0e,0x82,0x63,0xb1,0xe7,0xfb,0x64,0xdd,0xd8,
|
||||
0x1a,0x3d,0xdf,0x67,0x84,0xef,0x48,0xec,0xbb,0x72,0xcb,0xef,0x93,0xde,0xe8,0x99,
|
||||
0x95,0x57,0xfd,0xfe,0x6a,0xa8,0xfa,0x77,0xe5,0x1c,0x8f,0xae,0x91,0x5c,0x8e,0x9e,
|
||||
0xdb,0x94,0xfe,0x1e,0xd8,0xd1,0xe8,0xde,0xd7,0x89,0x4c,0xf5,0x8c,0x21,0x7e,0x11,
|
||||
0xdd,0xc7,0xfa,0x9d,0xef,0x87,0x78,0xa0,0x2e,0xbe,0xcb,0x77,0x73,0x49,0xfa,0xaf,
|
||||
0xf0,0x59,0x34,0xdd,0xd1,0x3b,0xf6,0xbe,0x95,0x93,0x55,0x76,0x2e,0xe5,0xde,0xb9,
|
||||
0xdc,0x18,0x3d,0xb7,0xf6,0x6a,0xf4,0x8c,0xc7,0x1b,0xd1,0x33,0x1e,0x6f,0x2d,0xf1,
|
||||
0xef,0xc1,0x48,0xfe,0x39,0xba,0xed,0x91,0xdb,0x92,0xef,0xa6,0x3e,0xb6,0x44,0xde,
|
||||
0x91,0x53,0xa7,0x7f,0xc7,0xea,0xfd,0x31,0xba,0x16,0x8d,0xa3,0x1a,0x92,0x52,0xc6,
|
||||
0x4a,0x8c,0xa9,0xeb,0x1e,0x99,0xec,0x3d,0xfe,0xcf,0xab,0xa2,0x4e,0xe7,0xc6,0xca,
|
||||
0x3d,0xc9,0x8e,0x27,0xc9,0xbc,0xde,0x7d,0x11,0x6f,0xb8,0xff,0xa6,0x31,0xac,0xe7,
|
||||
0x63,0x87,0x7f,0x56,0x61,0x63,0xf6,0x79,0xd6,0x4b,0xe4,0x1d,0xa3,0xb9,0xf7,0xd2,
|
||||
0x9f,0x89,0x5c,0xe9,0x68,0xce,0x3f,0xe7,0x3b,0x4b,0x57,0x91,0x67,0x7d,0x67,0x19,
|
||||
0x2a,0xa1,0xad,0x59,0x9c,0xb6,0xfc,0xfa,0xae,0xf9,0xe7,0x82,0x67,0xcb,0xd2,0x90,
|
||||
0x2f,0xdf,0x29,0x7b,0x64,0xc9,0xbe,0xb3,0xe1,0xb8,0xcd,0xbe,0xcb,0x75,0xea,0xfa,
|
||||
0x6e,0x69,0xcf,0x19,0x76,0xcf,0x34,0x19,0x57,0xd7,0x3d,0x56,0xd7,0xb9,0xeb,0x65,
|
||||
0x2f,0xaa,0xc6,0x75,0x8f,0xa3,0xb1,0xc0,0x5c,0xa7,0x7b,0xfd,0xfd,0x97,0x1d,0x2b,
|
||||
0x39,0x96,0xba,0x8f,0xdd,0x3d,0x4f,0x2d,0xdb,0x66,0x76,0x6d,0xae,0x93,0x6f,0xf8,
|
||||
0x7b,0xfb,0xde,0x84,0x1c,0x97,0xb8,0xe7,0x3a,0xe6,0xf1,0x3c,0xf5,0x51,0x75,0xc9,
|
||||
0x83,0x68,0x0c,0xec,0x77,0x55,0xf2,0xdc,0xa6,0x17,0xd1,0x58,0x3a,0x75,0x9d,0x1b,
|
||||
0x63,0x92,0xc1,0x75,0x6f,0xa6,0xff,0x66,0x7a,0x5e,0xe1,0xa3,0xe8,0x9a,0x46,0xfa,
|
||||
0xe7,0x59,0x67,0xdf,0x67,0xda,0xe2,0xeb,0x37,0xbc,0xcf,0x74,0x69,0xe6,0x98,0x1e,
|
||||
0xb7,0xd3,0xaf,0xe4,0xb9,0x5c,0xbf,0xc4,0x78,0xf4,0x6c,0x93,0xc9,0x62,0xcf,0x0f,
|
||||
0xae,0x80,0xeb,0x26,0xa3,0xef,0xf5,0x18,0xd7,0xea,0xf0,0x5f,0x31,0xff,0x4d,0xe3,
|
||||
0x65,0x34,0x16,0xd3,0xf5,0x67,0x95,0xf8,0xbd,0x91,0x21,0xff,0x1c,0x10,0xd7,0xf6,
|
||||
0xbb,0xa8,0xe7,0xd4,0x59,0xf5,0xe2,0x89,0xd7,0xfa,0x5d,0xf6,0x4b,0x25,0x27,0xf2,
|
||||
0x9e,0xbb,0x9a,0x7f,0xbe,0xfa,0xc8,0xfc,0x3c,0xe7,0xea,0x74,0xbe,0xbf,0xf3,0x59,
|
||||
0x55,0xb4,0x5f,0x1d,0xcf,0x73,0xae,0xd3,0xb2,0xa9,0xeb,0x32,0xa3,0xf8,0x05,0xff,
|
||||
0xcd,0xdb,0x7f,0x33,0x7f,0xbf,0x7c,0x9b,0x79,0xde,0x63,0x36,0xfb,0xf4,0x7c,0xbb,
|
||||
0xa1,0x5e,0x6c,0xf1,0xd7,0xc3,0x4e,0x15,0x7d,0x27,0x14,0x79,0x95,0xbe,0xd6,0x53,
|
||||
0x72,0x2e,0xef,0xb8,0xeb,0xd2,0xed,0xaf,0x47,0xde,0x9e,0xe7,0xbd,0x4a,0xee,0x99,
|
||||
0x9c,0xd9,0xb6,0xeb,0xb3,0xaa,0xe8,0x93,0x88,0xdf,0x0f,0x96,0x1b,0x57,0xf7,0xa0,
|
||||
0x94,0x77,0x4e,0x00,0xfe,0x9b,0xa7,0xff,0x8a,0x39,0xf1,0x69,0xb6,0x8f,0xcc,0xd7,
|
||||
0x13,0xe7,0xd7,0x47,0x36,0xe8,0xcf,0xd1,0x2e,0x7f,0xbe,0x66,0xdd,0xd8,0x18,0xf5,
|
||||
0x11,0x1c,0xc6,0x69,0x33,0xbc,0xc3,0xb5,0x3e,0xea,0xd7,0xb9,0xe2,0xfb,0x75,0x3a,
|
||||
0x5f,0xf1,0x3d,0x39,0xf7,0xb2,0xd7,0xe8,0xdc,0x7d,0x99,0x51,0x7f,0x44,0x15,0x3d,
|
||||
0xb3,0x29,0x7c,0x19,0x8d,0x37,0x71,0x7f,0x77,0x1f,0x9a,0x37,0xfa,0x5e,0x09,0xfc,
|
||||
0x57,0x75,0xfe,0x2b,0xfe,0x9d,0x5d,0xc0,0x71,0xef,0xd2,0x17,0xf5,0xa9,0xb6,0x46,
|
||||
0x7d,0xaa,0x97,0xa2,0xfe,0xd4,0xb3,0x51,0x5f,0x6a,0xdd,0x92,0x6f,0x5b,0x1f,0x8b,
|
||||
0x7c,0xff,0x6d,0xd4,0x4f,0xdc,0x1c,0xf5,0x1d,0x77,0x2d,0xe0,0x38,0xc8,0xc8,0x73,
|
||||
0x99,0xec,0x33,0xd6,0x27,0xab,0xef,0x99,0x9c,0xfe,0x39,0x26,0x93,0xd1,0x7d,0x61,
|
||||
0xae,0x5f,0x8e,0x31,0xc4,0xf8,0x6f,0x09,0xfa,0xaf,0x28,0xb9,0xf7,0xe5,0x65,0x9f,
|
||||
0xd1,0x73,0xbf,0x0c,0xd7,0xa3,0xa7,0xc6,0x9f,0x74,0xc6,0xc6,0xbb,0x34,0x9b,0xa9,
|
||||
0xb1,0x30,0x8e,0x7a,0x7b,0x2a,0x36,0x0e,0xa5,0x90,0x74,0x6d,0xf2,0xa3,0x32,0xdb,
|
||||
0x32,0x72,0xef,0x31,0xcc,0xd2,0x92,0x1f,0x7f,0xd3,0x1a,0x1b,0x23,0xd3,0xbf,0xe0,
|
||||
0xdf,0xa7,0xbb,0xf9,0x6b,0x73,0xd9,0xb1,0x25,0xb9,0x77,0x81,0x55,0xdf,0x33,0xd6,
|
||||
0x5f,0xe6,0x9f,0x43,0x97,0x6b,0x37,0xe0,0x02,0xfc,0xb7,0xb8,0xfe,0x7b,0x18,0x4e,
|
||||
0x44,0xed,0x9d,0x97,0x55,0x30,0xa6,0xbe,0xf0,0xf9,0x65,0xf7,0x69,0xeb,0xcc,0x38,
|
||||
0x6e,0xce,0xed,0x97,0xf8,0x3b,0x5c,0x27,0xab,0xfe,0x5d,0x39,0x05,0xe3,0x4d,0x18,
|
||||
0x5b,0x07,0x55,0x38,0xfe,0x39,0x7b,0x0d,0xe8,0x71,0x54,0x67,0xa8,0xbe,0x76,0x51,
|
||||
0xee,0xfe,0xca,0xa9,0x67,0xa0,0x65,0xc7,0x2e,0x16,0x7f,0x46,0xed,0x52,0x22,0xf7,
|
||||
0x1c,0xdd,0xf1,0xe8,0x79,0xbc,0xc9,0x77,0x53,0xbf,0x58,0x22,0xef,0xf4,0x7a,0x9e,
|
||||
0xbf,0x37,0x6c,0x42,0x5d,0x47,0xbf,0x04,0x2c,0xdd,0xfb,0x3f,0xdc,0xbd,0x97,0xe3,
|
||||
0xd1,0xb5,0xa2,0xa5,0xf3,0x2e,0xbe,0xc2,0xf7,0xd2,0x7f,0x97,0x7b,0xce,0x50,0xe4,
|
||||
0x95,0x6c,0xdd,0x72,0x2c,0x73,0xbf,0xe8,0xf3,0xbe,0xd3,0xb6,0xc9,0xef,0x9a,0xd9,
|
||||
0x96,0x71,0xdf,0xb7,0x41,0xb3,0xeb,0x9b,0xc8,0x97,0x23,0x3b,0x2e,0x2e,0x57,0xc6,
|
||||
0x97,0x4b,0xf6,0xbd,0x0d,0x09,0xcf,0xf9,0xeb,0xbb,0xb4,0x5f,0xe1,0xf5,0xf2,0x5f,
|
||||
0xb1,0x67,0xb7,0x4e,0x98,0xaa,0xbc,0x76,0x0e,0x65,0xa8,0xcf,0xbd,0x48,0x78,0x2e,
|
||||
0xfb,0xcc,0x61,0xce,0x59,0x78,0x33,0xfd,0x57,0x74,0x8c,0x58,0xbe,0x8e,0xc3,0xfb,
|
||||
0x4c,0x5f,0x13,0xcf,0x51,0x9f,0x03,0xfc,0x37,0x6f,0x46,0xb3,0xcf,0x68,0x0b,0xb3,
|
||||
0xcf,0x68,0x7b,0x5a,0x25,0xf7,0x42,0xe1,0xb9,0xa9,0x76,0xeb,0xa3,0xfc,0xf3,0xd5,
|
||||
0x39,0x07,0x01,0xff,0x2d,0xd6,0xf3,0xfe,0xb3,0xcf,0x38,0x9a,0xc8,0xbf,0x13,0xfa,
|
||||
0x05,0x5e,0x5a,0xf0,0x7b,0xc0,0x72,0xef,0x90,0x70,0x8e,0xcb,0xbd,0x07,0x8c,0x7e,
|
||||
0x08,0xc0,0x7f,0xd5,0xfa,0xfe,0xf3,0x6c,0x5f,0xc2,0x98,0xef,0x33,0x98,0x88,0xfa,
|
||||
0x3e,0xbf,0xe7,0x1a,0x63,0xd1,0x77,0xb8,0x3e,0x4d,0xf4,0xeb,0x8c,0xbd,0xf6,0xef,
|
||||
0xc9,0x01,0xfc,0xf7,0x3a,0xfb,0xaf,0xb4,0x71,0x6f,0xb9,0xb1,0xbd,0xd9,0xb1,0x8b,
|
||||
0xdf,0x57,0xd7,0xfd,0x5a,0xaf,0x30,0x46,0x2e,0xfe,0x6e,0x6a,0x37,0x56,0x2e,0x72,
|
||||
0x5b,0x86,0x71,0x90,0x80,0xff,0xde,0x64,0xff,0x95,0x3e,0x8e,0x2e,0xdb,0xce,0xce,
|
||||
0xfb,0x32,0x36,0x16,0x26,0xee,0xcd,0x99,0x79,0x51,0xc2,0x98,0xed,0xe2,0x4c,0xc6,
|
||||
0xd6,0x37,0x31,0x35,0xfe,0x26,0x36,0x46,0x86,0x71,0xc0,0x80,0xff,0xf0,0x1f,0x00,
|
||||
0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,
|
||||
0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,
|
||||
0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,
|
||||
0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,
|
||||
0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,
|
||||
0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,
|
||||
0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,
|
||||
0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,
|
||||
0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,
|
||||
0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,
|
||||
0x00,0xfc,0xc7,0xfe,0x07,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,
|
||||
0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,
|
||||
0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,
|
||||
0x00,0xc0,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,
|
||||
0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,
|
||||
0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,
|
||||
0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xd8,
|
||||
0xff,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,
|
||||
0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,
|
||||
0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,
|
||||
0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,
|
||||
0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,
|
||||
0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,
|
||||
0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,
|
||||
0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,
|
||||
0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,
|
||||
0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,
|
||||
0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,
|
||||
0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,
|
||||
0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,
|
||||
0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,
|
||||
0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0x96,0xb6,0xff,0x86,0xf1,
|
||||
0x1f,0x00,0x50,0xff,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,
|
||||
0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,
|
||||
0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,
|
||||
0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,
|
||||
0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,
|
||||
0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,
|
||||
0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xec,0x7f,0x00,0xc0,
|
||||
0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,
|
||||
0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,
|
||||
0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0xf8,0x0f,
|
||||
0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,
|
||||
0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,
|
||||
0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,
|
||||
0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x8f,0xfd,0x0f,0x00,0xf8,0x0f,0x00,0x00,
|
||||
0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,
|
||||
0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,
|
||||
0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,
|
||||
0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,
|
||||
0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,
|
||||
0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,
|
||||
0x87,0xff,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,
|
||||
0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,
|
||||
0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,
|
||||
0x1f,0x00,0x00,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,
|
||||
0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,
|
||||
0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,
|
||||
0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,
|
||||
0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,
|
||||
0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,
|
||||
0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x80,0xff,0xf0,
|
||||
0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,
|
||||
0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,
|
||||
0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,
|
||||
0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0x00,0x00,0xfc,
|
||||
0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,
|
||||
0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,
|
||||
0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,
|
||||
0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,
|
||||
0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,
|
||||
0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,
|
||||
0xfe,0x03,0x00,0xfc,0xc7,0xfe,0x07,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,
|
||||
0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,
|
||||
0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,
|
||||
0xfe,0x03,0x00,0xc0,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,
|
||||
0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,
|
||||
0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,
|
||||
0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,
|
||||
0xff,0xd8,0xff,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,
|
||||
0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,
|
||||
0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,
|
||||
0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,
|
||||
0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,
|
||||
0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,
|
||||
0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0x00,0x00,
|
||||
0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,
|
||||
0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,
|
||||
0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0xc0,0x7f,
|
||||
0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,
|
||||
0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,
|
||||
0xff,0x95,0xe0,0xbf,0x11,0x19,0x31,0x00,0x00,0x95,0xa3,0x82,0xfe,0x0b,0x74,0xfd,
|
||||
0x00,0x00,0x95,0x62,0x51,0xfd,0xf7,0x38,0x11,0xf6,0x3f,0x00,0x54,0xd6,0x7f,0x8f,
|
||||
0x6d,0xdc,0x49,0xe5,0xf5,0xdf,0xa3,0x44,0xa8,0x7b,0x03,0x40,0x65,0x79,0x64,0xe3,
|
||||
0x4e,0x2a,0xaf,0xff,0x26,0x12,0xb9,0x1d,0xdc,0x36,0x00,0x00,0x15,0x43,0x26,0x6c,
|
||||
0xdc,0x49,0xf8,0x0f,0x00,0xf0,0x5f,0x39,0xf2,0x30,0x91,0xdb,0xe2,0xd6,0x0f,0x00,
|
||||
0x50,0x29,0x1e,0xda,0xb8,0x93,0xca,0xeb,0xbf,0xf1,0x44,0x86,0x83,0x61,0x03,0x00,
|
||||
0x50,0x31,0x64,0xdc,0xc6,0x9d,0x54,0x5e,0xff,0x8d,0x25,0x32,0x2c,0x6e,0xfd,0x00,
|
||||
0x00,0x95,0x62,0xcc,0xc6,0x9d,0x54,0x5e,0xff,0x3d,0x48,0x64,0x48,0x86,0x0c,0x00,
|
||||
0x40,0xe5,0x78,0x60,0xe3,0x4e,0x2a,0xaf,0xff,0xee,0x27,0xc2,0xbe,0x07,0x80,0xca,
|
||||
0x72,0xdf,0xc6,0x9d,0x54,0x5e,0xff,0xdd,0x4b,0x64,0x50,0x06,0x0d,0x00,0x40,0xe5,
|
||||
0xb8,0x67,0xe3,0x4e,0x2a,0xaf,0xff,0xee,0x26,0xa2,0xeb,0xb7,0x00,0x00,0x95,0xe3,
|
||||
0xae,0x8d,0x3b,0xa9,0xbc,0xfe,0xbb,0x93,0xc8,0x80,0x0c,0x18,0x00,0x80,0xca,0x71,
|
||||
0xc7,0xc6,0x9d,0x54,0x5e,0xff,0x8d,0x24,0xa2,0xeb,0xb7,0x00,0x00,0x95,0x63,0xc4,
|
||||
0xc6,0x9d,0x54,0x5e,0xff,0xdd,0x4e,0xa4,0x5f,0xfa,0x0d,0x00,0x40,0xe5,0xb8,0x6d,
|
||||
0xe3,0x4e,0x5a,0x64,0xff,0x59,0x00,0x80,0xca,0x31,0x6c,0x87,0x65,0x2a,0xe5,0xf5,
|
||||
0xdf,0x60,0x22,0xb7,0xe4,0x96,0x05,0x00,0xa8,0x1c,0xbe,0x1f,0x24,0x9f,0xf2,0xfa,
|
||||
0x6f,0x20,0x11,0xf6,0x3d,0x00,0x54,0x16,0x7f,0x1d,0x30,0x6f,0xa4,0x72,0xfb,0xaf,
|
||||
0x3f,0x96,0x3e,0xe9,0xb3,0x00,0x00,0x95,0xc3,0xb7,0x83,0xa3,0x74,0x95,0xd9,0x7f,
|
||||
0xde,0x79,0xf1,0xb0,0xff,0x01,0xa0,0xd2,0x44,0xb9,0x5a,0xf6,0xfa,0xdf,0xcd,0x64,
|
||||
0x2c,0x00,0x40,0x85,0x89,0x72,0xae,0xec,0xfd,0x1f,0x3d,0x89,0xb0,0xef,0x01,0xa0,
|
||||
0x72,0x24,0x7d,0x54,0x57,0x66,0xff,0x2d,0xd3,0x75,0x74,0xc7,0xd2,0x23,0xbd,0xd2,
|
||||
0x6b,0x01,0x00,0x16,0x9f,0x1e,0x1b,0xb7,0x51,0x67,0xd9,0xed,0xb7,0x4c,0x7d,0xd7,
|
||||
0x99,0x48,0x37,0xc7,0x01,0x00,0x2a,0x80,0x1a,0xcf,0xc6,0x5d,0x74,0x69,0x11,0xfc,
|
||||
0xd7,0x2f,0x37,0x0a,0xd2,0xe5,0xea,0xa0,0x00,0x00,0x8b,0x48,0x97,0x2d,0x34,0xd1,
|
||||
0xa9,0x45,0xf0,0x9f,0x6b,0x01,0x77,0x14,0xe4,0x86,0x74,0x73,0x3c,0x00,0x60,0x91,
|
||||
0xe8,0x56,0xf7,0x15,0x5a,0xe8,0xc2,0xa2,0xd8,0x6f,0x99,0x0c,0xe9,0xba,0xda,0xa6,
|
||||
0xa5,0x43,0x7d,0xdc,0xcd,0xb1,0x01,0x80,0x32,0xd2,0x2d,0x5d,0xce,0x3f,0xb6,0xd0,
|
||||
0x3f,0x2d,0x8b,0x64,0x3f,0x97,0x5b,0xd2,0x4a,0x08,0x21,0x55,0x93,0x93,0x8b,0xe8,
|
||||
0xbf,0x65,0xd2,0x2d,0xd7,0x08,0x21,0xa4,0x2a,0x72,0x76,0x51,0xed,0xe7,0xd2,0x21,
|
||||
0x17,0x09,0x21,0xa4,0xe2,0x39,0xbd,0xe8,0xf6,0x73,0xe9,0x92,0x0b,0x52,0x4f,0x08,
|
||||
0x21,0x15,0xcb,0x29,0x39,0x22,0xb5,0x15,0xf1,0x9f,0x4b,0xb3,0x1c,0x27,0x84,0x90,
|
||||
0x8a,0xe4,0x88,0x1c,0xd2,0x2c,0xab,0x60,0xda,0xe5,0x9c,0x1c,0x56,0x03,0x13,0x42,
|
||||
0xc8,0xe2,0xc5,0x99,0xef,0xb0,0xcf,0xb2,0x8a,0xa7,0x5b,0xae,0x68,0x5d,0xf4,0x98,
|
||||
0xec,0x23,0x84,0x90,0xb2,0xe5,0x80,0x1c,0xf4,0xde,0x3b,0x92,0xcf,0x32,0x42,0x08,
|
||||
0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,
|
||||
0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,
|
||||
0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x54,
|
||||
0x79,0xfe,0x3f,0x57,0x9d,0xaa,0x31};
|
BIN
source/ngc/ttf/font.ttf
Normal file
BIN
source/ngc/ttf/font.ttf
Normal file
Binary file not shown.
619
source/ngc/video.cpp
Normal file
619
source/ngc/video.cpp
Normal file
@ -0,0 +1,619 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Video
|
||||
*
|
||||
* This is a modified renderer from the Genesis Plus Project.
|
||||
* Well - you didn't expect me to write another one did ya ? -;)
|
||||
*
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
//#include "debug.h"
|
||||
//#include "cpuexec.h"
|
||||
//#include "ppu.h"
|
||||
//#include "apu.h"
|
||||
//#include "display.h"
|
||||
//#include "gfx.h"
|
||||
//#include "soundux.h"
|
||||
//#include "spc700.h"
|
||||
//#include "spc7110.h"
|
||||
//#include "controls.h"
|
||||
#include "aram.h"
|
||||
//#include "video.h"
|
||||
|
||||
/*** Snes9x GFX Buffer ***/
|
||||
static unsigned char snes9xgfx[1024 * 512 * 2];
|
||||
|
||||
/*** Memory ROM Loading ***/
|
||||
extern unsigned long ARAM_ROMSIZE;
|
||||
extern unsigned int SMBTimer;
|
||||
|
||||
/*** 2D Video ***/
|
||||
unsigned int *xfb[2] = { NULL, NULL }; /*** Double buffered ***/
|
||||
int whichfb = 0; /*** Switch ***/
|
||||
GXRModeObj *vmode; /*** General video mode ***/
|
||||
int screenheight = 480;
|
||||
|
||||
/*** GX ***/
|
||||
#define TEX_WIDTH 512
|
||||
#define TEX_HEIGHT 512
|
||||
#define DEFAULT_FIFO_SIZE 256 * 1024
|
||||
unsigned int copynow = GX_FALSE;
|
||||
static unsigned char gp_fifo[DEFAULT_FIFO_SIZE] ATTRIBUTE_ALIGN (32);
|
||||
static unsigned char texturemem[TEX_WIDTH * (TEX_HEIGHT + 8)] ATTRIBUTE_ALIGN (32);
|
||||
GXTexObj texobj;
|
||||
static Mtx view;
|
||||
int vwidth, vheight, oldvwidth, oldvheight;
|
||||
|
||||
u32 FrameTimer = 0;
|
||||
|
||||
#define HASPECT 76
|
||||
#define VASPECT 54
|
||||
|
||||
/* New texture based scaler */
|
||||
typedef struct tagcamera
|
||||
{
|
||||
Vector pos;
|
||||
Vector up;
|
||||
Vector view;
|
||||
}
|
||||
camera;
|
||||
|
||||
/*** Square Matrix
|
||||
This structure controls the size of the image on the screen.
|
||||
Think of the output as a -80 x 80 by -60 x 60 graph.
|
||||
***/
|
||||
s16 square[] ATTRIBUTE_ALIGN (32) =
|
||||
{
|
||||
/*
|
||||
* X, Y, Z
|
||||
* Values set are for roughly 4:3 aspect
|
||||
*/
|
||||
-HASPECT, VASPECT, 0, // 0
|
||||
HASPECT, VASPECT, 0, // 1
|
||||
HASPECT, -VASPECT, 0, // 2
|
||||
-HASPECT, -VASPECT, 0, // 3
|
||||
};
|
||||
|
||||
static camera cam = { {0.0F, 0.0F, 0.0F},
|
||||
{0.0F, 0.5F, 0.0F},
|
||||
{0.0F, 0.0F, -0.5F}
|
||||
};
|
||||
|
||||
#ifdef VIDEO_THREADING
|
||||
/****************************************************************************
|
||||
* VideoThreading
|
||||
****************************************************************************/
|
||||
#define TSTACK 16384
|
||||
lwpq_t videoblankqueue;
|
||||
lwp_t vbthread;
|
||||
static unsigned char vbstack[TSTACK];
|
||||
|
||||
/****************************************************************************
|
||||
* vbgetback
|
||||
*
|
||||
* This callback enables the emulator to keep running while waiting for a
|
||||
* vertical blank.
|
||||
*
|
||||
* Putting LWP to good use :)
|
||||
****************************************************************************/
|
||||
static void *
|
||||
vbgetback (void *arg)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
VIDEO_WaitVSync (); /**< Wait for video vertical blank */
|
||||
LWP_SuspendThread (vbthread);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* InitVideoThread
|
||||
*
|
||||
* libOGC provides a nice wrapper for LWP access.
|
||||
* This function sets up a new local queue and attaches the thread to it.
|
||||
****************************************************************************/
|
||||
void
|
||||
InitVideoThread ()
|
||||
{
|
||||
/*** Initialise a new queue ***/
|
||||
LWP_InitQueue (&videoblankqueue);
|
||||
|
||||
/*** Create the thread on this queue ***/
|
||||
LWP_CreateThread (&vbthread, vbgetback, NULL, vbstack, TSTACK, 80);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* copy_to_xfb
|
||||
*
|
||||
* Stock code to copy the GX buffer to the current display mode.
|
||||
* Also increments the frameticker, as it's called for each vb.
|
||||
****************************************************************************/
|
||||
static void
|
||||
copy_to_xfb (u32 arg)
|
||||
{
|
||||
|
||||
if (copynow == GX_TRUE)
|
||||
{
|
||||
GX_SetZMode (GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
GX_SetColorUpdate (GX_TRUE);
|
||||
GX_CopyDisp (xfb[whichfb], GX_TRUE);
|
||||
GX_Flush ();
|
||||
copynow = GX_FALSE;
|
||||
}
|
||||
|
||||
FrameTimer++;
|
||||
SMBTimer++;
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* WIP3 - Scaler Support Functions
|
||||
****************************************************************************/
|
||||
static void
|
||||
draw_init ()
|
||||
{
|
||||
GX_ClearVtxDesc ();
|
||||
GX_SetVtxDesc (GX_VA_POS, GX_INDEX8);
|
||||
GX_SetVtxDesc (GX_VA_CLR0, GX_INDEX8);
|
||||
GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);
|
||||
|
||||
GX_SetVtxAttrFmt (GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
||||
GX_SetVtxAttrFmt (GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GX_SetVtxAttrFmt (GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||
|
||||
GX_SetArray (GX_VA_POS, square, 3 * sizeof (s16));
|
||||
|
||||
GX_SetNumTexGens (1);
|
||||
GX_SetTexCoordGen (GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
|
||||
GX_InvalidateTexAll ();
|
||||
GX_InitTexObj (&texobj, texturemem, vwidth, vheight, GX_TF_RGB565,
|
||||
GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_vert (u8 pos, u8 c, f32 s, f32 t)
|
||||
{
|
||||
GX_Position1x8 (pos);
|
||||
GX_Color1x8 (c);
|
||||
GX_TexCoord2f32 (s, t);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_square (Mtx v)
|
||||
{
|
||||
Mtx m; // model matrix.
|
||||
Mtx mv; // modelview matrix.
|
||||
|
||||
/*
|
||||
* Use C functions!
|
||||
* Calling the faster asm ones cause reboot!
|
||||
*/
|
||||
guMtxIdentity (m);
|
||||
guMtxTransApply (m, m, 0, 0, -100);
|
||||
guMtxConcat (v, m, mv);
|
||||
|
||||
GX_LoadPosMtxImm (mv, GX_PNMTX0);
|
||||
GX_Begin (GX_QUADS, GX_VTXFMT0, 4);
|
||||
draw_vert (0, 0, 0.0, 0.0);
|
||||
draw_vert (1, 0, 1.0, 0.0);
|
||||
draw_vert (2, 0, 1.0, 1.0);
|
||||
draw_vert (3, 0, 0.0, 1.0);
|
||||
GX_End ();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* StartGX
|
||||
*
|
||||
* This function initialises the GX.
|
||||
* WIP3 - Based on texturetest from libOGC examples.
|
||||
****************************************************************************/
|
||||
static void
|
||||
StartGX ()
|
||||
{
|
||||
Mtx p;
|
||||
|
||||
GXColor background = { 0, 0, 0, 0xff };
|
||||
|
||||
/*** Clear out FIFO area ***/
|
||||
memset (&gp_fifo, 0, DEFAULT_FIFO_SIZE);
|
||||
|
||||
/*** Initialise GX ***/
|
||||
GX_Init (&gp_fifo, DEFAULT_FIFO_SIZE);
|
||||
GX_SetCopyClear (background, 0x00ffffff);
|
||||
|
||||
GX_SetViewport (0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
|
||||
GX_SetDispCopyYScale ((f32) vmode->xfbHeight / (f32) vmode->efbHeight);
|
||||
GX_SetScissor (0, 0, vmode->fbWidth, vmode->efbHeight);
|
||||
GX_SetDispCopySrc (0, 0, vmode->fbWidth, vmode->efbHeight);
|
||||
GX_SetDispCopyDst (vmode->fbWidth, vmode->xfbHeight);
|
||||
GX_SetCopyFilter (vmode->aa, vmode->sample_pattern, GX_TRUE,
|
||||
vmode->vfilter);
|
||||
GX_SetFieldMode (vmode->field_rendering,
|
||||
((vmode->viHeight ==
|
||||
2 * vmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
|
||||
GX_SetPixelFmt (GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
||||
GX_SetCullMode (GX_CULL_NONE);
|
||||
GX_CopyDisp (xfb[whichfb], GX_TRUE);
|
||||
GX_SetDispCopyGamma (GX_GM_1_0);
|
||||
|
||||
guPerspective (p, 60, 1.33F, 10.0F, 1000.0F);
|
||||
GX_LoadProjectionMtx (p, GX_PERSPECTIVE);
|
||||
|
||||
vwidth = 100;
|
||||
vheight = 100;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* InitGCVideo
|
||||
*
|
||||
* This function MUST be called at startup.
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
InitGCVideo ()
|
||||
{
|
||||
/*
|
||||
* Before doing anything else under libogc,
|
||||
* Call VIDEO_Init
|
||||
*/
|
||||
|
||||
int *romptr = (int *) 0x81000000;
|
||||
|
||||
VIDEO_Init ();
|
||||
PAD_Init ();
|
||||
DVD_Init ();
|
||||
|
||||
/*** Check to see if this is a GC or a Wii ***/
|
||||
// int driveid = dvd_driveid();
|
||||
// bool8 isWii = !((driveid == 4) || (driveid == 6) || (driveid == 8));
|
||||
|
||||
AUDIO_Init (NULL);
|
||||
AR_Init (NULL, 0);
|
||||
|
||||
/* Before going any further, let's copy any attached ROM image ** */
|
||||
if (memcmp ((char *) romptr, "SNESROM0", 8) == 0)
|
||||
{
|
||||
ARAM_ROMSIZE = romptr[2];
|
||||
romptr = (int *) 0x81000020;
|
||||
ARAMPut ((char *) romptr, (char *) AR_SNESROM, ARAM_ROMSIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Always use NTSC mode - this works on NTSC and PAL, GC and Wii
|
||||
*/
|
||||
vmode = &TVNtsc480IntDf;
|
||||
VIDEO_Configure (vmode);
|
||||
|
||||
screenheight = vmode->xfbHeight;
|
||||
|
||||
/*
|
||||
* Allocate the video buffers
|
||||
*/
|
||||
xfb[0] = (unsigned int *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||
xfb[1] = (unsigned int *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||
|
||||
/*
|
||||
* A console is always useful while debugging.
|
||||
*/
|
||||
console_init (xfb[0], 20, 64, vmode->fbWidth, vmode->xfbHeight,
|
||||
vmode->fbWidth * 2);
|
||||
|
||||
/*
|
||||
* Clear framebuffers etc.
|
||||
*/
|
||||
VIDEO_ClearFrameBuffer (vmode, xfb[0], COLOR_BLACK);
|
||||
VIDEO_ClearFrameBuffer (vmode, xfb[1], COLOR_BLACK);
|
||||
VIDEO_SetNextFramebuffer (xfb[0]);
|
||||
|
||||
/*
|
||||
* Let libogc populate manage the PADs for us
|
||||
*/
|
||||
VIDEO_SetPostRetraceCallback (PAD_ScanPads);
|
||||
VIDEO_SetPreRetraceCallback (copy_to_xfb);
|
||||
VIDEO_SetBlack (FALSE);
|
||||
VIDEO_Flush ();
|
||||
VIDEO_WaitVSync ();
|
||||
if (vmode->viTVMode & VI_NON_INTERLACE)
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
// DVD_Init ();
|
||||
copynow = GX_FALSE;
|
||||
StartGX ();
|
||||
|
||||
#ifdef VIDEO_THREADING
|
||||
InitVideoThread ();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Finally, the video is up and ready for use :)
|
||||
*/
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Drawing screen
|
||||
****************************************************************************/
|
||||
void
|
||||
clearscreen ()
|
||||
{
|
||||
whichfb ^= 1;
|
||||
ARAMFetch ((char *) xfb[whichfb], (char *) AR_BACKDROP,
|
||||
640 * screenheight * 2);
|
||||
}
|
||||
|
||||
void
|
||||
showscreen ()
|
||||
{
|
||||
copynow = GX_FALSE;
|
||||
VIDEO_SetNextFramebuffer (xfb[whichfb]);
|
||||
VIDEO_Flush ();
|
||||
VIDEO_WaitVSync ();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* setGFX
|
||||
*
|
||||
* Setup the global GFX information for Snes9x
|
||||
****************************************************************************/
|
||||
void
|
||||
setGFX ()
|
||||
{
|
||||
GFX.Screen = (unsigned short *) snes9xgfx;
|
||||
GFX.Pitch = 1024;
|
||||
}
|
||||
|
||||
#ifndef NGCC
|
||||
#if 0
|
||||
/****************************************************************************
|
||||
* MakeTexture
|
||||
*
|
||||
* GC requires RGB565 colour tiles of 4 x 4 pixels.
|
||||
* Ok, apparently the pipeline stalls waiting for the indexed register to update.
|
||||
* Solution : Use R9 to mirror R4
|
||||
*
|
||||
* THIS IS NOW UNUSED, BUT LEFT HERE SO I CAN TINKER -;)
|
||||
****************************************************************************/
|
||||
void
|
||||
MakeTexture (char *src, /*** R3 Pointer to source ***/
|
||||
char *dst, /*** R4 Pointer to output ***/
|
||||
int width, /*** R5 Width ***/
|
||||
int height, /*** R6 Height ***/
|
||||
int w1, /*** R7 Worker ***/
|
||||
int w2, /*** R8 Worker ***/
|
||||
int w3, /*** R9 Worker ***/
|
||||
int w4) /*** R10 Worker ***/
|
||||
{
|
||||
/*** How many tiles per row ***/
|
||||
asm ("srwi 5,5,2"); /*** Width / 4 == Tiles ***/
|
||||
asm ("srwi 6,6,2"); /*** Height / 4 == Tiles ***/
|
||||
|
||||
asm ("mr 9,4"); /*** Mirror R4 ***/
|
||||
asm ("subi 4,4,8"); /*** Adjust R4 for index update ***/
|
||||
asm ("subi 9,9,4"); /*** Adjust R9 for index update ***/
|
||||
|
||||
/*** Outer loop ***/
|
||||
asm ("DoAllTiles:");
|
||||
|
||||
asm ("mtctr 5"); /*** Will loop for this number of tiles across ***/
|
||||
asm ("mr 8,3"); /*** Preserve current source position ***/
|
||||
|
||||
asm ("DoOneTile:");
|
||||
|
||||
/*** Store 4 Horizontal Pixels - ROW 1 ***/
|
||||
asm ("lwz 7,0(3)");
|
||||
asm ("stwu 7,8(4)");
|
||||
asm ("lwz 10,4(3)");
|
||||
asm ("stwu 10,8(9)");
|
||||
|
||||
/*** Store 4 Horizontal Pixels - ROW 2 ***/
|
||||
asm ("lwz 7,1024(3)");
|
||||
asm ("stwu 7,8(4)");
|
||||
asm ("lwz 10,1028(3)");
|
||||
asm ("stwu 10,8(9)");
|
||||
|
||||
/*** Store 4 Horizontal Pixels - ROW 3 ***/
|
||||
asm ("lwz 7,2048(3)");
|
||||
asm ("stwu 7,8(4)");
|
||||
asm ("lwz 10,2052(3)");
|
||||
asm ("stwu 10,8(9)");
|
||||
|
||||
/*** Store 4 Horizontal Pixels - ROW 4 ***/
|
||||
asm ("lwz 7,3072(3)");
|
||||
asm ("stwu 7,8(4)");
|
||||
asm ("lwz 10,3076(3)");
|
||||
asm ("stwu 10,8(9)");
|
||||
|
||||
/*** Move along 4 pixels ***/
|
||||
asm ("addi 3,3,8");
|
||||
|
||||
/*** Repeat for next tile ***/
|
||||
asm ("bdnz DoOneTile");
|
||||
|
||||
/*** Update R3 to be 4 rows down ***/
|
||||
asm ("mr 3,8");
|
||||
asm ("addi 3,3,4096");
|
||||
|
||||
/*** Decrement Outer Tile loop ***/
|
||||
asm ("subi 6,6,1");
|
||||
asm ("cmpwi 6,0");
|
||||
asm ("bne DoAllTiles");
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* MakeTexture
|
||||
*
|
||||
* Proper GNU Asm rendition of the above, converted by shagkur. - Thanks!
|
||||
****************************************************************************/
|
||||
void
|
||||
MakeTexture (const void *src, void *dst, s32 width, s32 height)
|
||||
{
|
||||
register u32 tmp0 = 0, tmp1 = 0, tmp2 = 0, tmp3 = 0;
|
||||
|
||||
__asm__ __volatile__ (" srwi %6,%6,2\n"
|
||||
" srwi %7,%7,2\n"
|
||||
" subi %3,%4,4\n"
|
||||
" mr %4,%3\n"
|
||||
" subi %4,%4,4\n"
|
||||
"2: mtctr %6\n"
|
||||
" mr %0,%5\n"
|
||||
//
|
||||
"1: lwz %1,0(%5)\n"
|
||||
" stwu %1,8(%4)\n"
|
||||
" lwz %2,4(%5)\n"
|
||||
" stwu %2,8(%3)\n"
|
||||
" lwz %1,1024(%5)\n"
|
||||
" stwu %1,8(%4)\n"
|
||||
" lwz %2,1028(%5)\n"
|
||||
" stwu %2,8(%3)\n"
|
||||
" lwz %1,2048(%5)\n"
|
||||
" stwu %1,8(%4)\n"
|
||||
" lwz %2,2052(%5)\n"
|
||||
" stwu %2,8(%3)\n"
|
||||
" lwz %1,3072(%5)\n"
|
||||
" stwu %1,8(%4)\n"
|
||||
" lwz %2,3076(%5)\n"
|
||||
" stwu %2,8(%3)\n"
|
||||
" addi %5,%5,8\n"
|
||||
" bdnz 1b\n"
|
||||
" addi %5,%0,4096\n"
|
||||
" subic. %7,%7,1\n"
|
||||
" bne 2b"
|
||||
// 0 1 2 3 4 5 6 7
|
||||
:"=&r" (tmp0), "=&r" (tmp1), "=&r" (tmp2),
|
||||
"=&r" (tmp3), "+r" (dst):"r" (src), "r" (width),
|
||||
"r" (height));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Update Video
|
||||
****************************************************************************/
|
||||
void
|
||||
update_video (int width, int height)
|
||||
{
|
||||
vwidth = width;
|
||||
vheight = height;
|
||||
|
||||
#ifdef VIDEO_THREADING
|
||||
/* Ensure previous vb has complete */
|
||||
while ((LWP_ThreadIsSuspended (vbthread) == 0) || (copynow == GX_TRUE))
|
||||
#else
|
||||
while (copynow == GX_TRUE)
|
||||
#endif
|
||||
{
|
||||
usleep (50);
|
||||
}
|
||||
|
||||
whichfb ^= 1;
|
||||
|
||||
if ((oldvheight != vheight) || (oldvwidth != vwidth))
|
||||
{
|
||||
/** Update scaling **/
|
||||
oldvwidth = vwidth;
|
||||
oldvheight = vheight;
|
||||
draw_init ();
|
||||
|
||||
memset (&view, 0, sizeof (Mtx));
|
||||
guLookAt(view, &cam.pos, &cam.up, &cam.view);
|
||||
GX_SetViewport (0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
|
||||
}
|
||||
|
||||
GX_InvVtxCache ();
|
||||
GX_InvalidateTexAll ();
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_DECAL);
|
||||
GX_SetTevOrder (GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
|
||||
#ifdef NGCC
|
||||
int h, w;
|
||||
int *dst = (int *) texturemem;
|
||||
int *src = (int *) GFX.Screen;
|
||||
int hpos;
|
||||
|
||||
/*** Pitch for screen, regardless of size is always the same ***/
|
||||
for (h = 0; h < vheight; h += 4)
|
||||
{
|
||||
|
||||
for (w = 0; w < (vwidth >> 1); w += 2)
|
||||
{
|
||||
|
||||
hpos = w;
|
||||
*dst++ = src[hpos++];
|
||||
*dst++ = src[hpos];
|
||||
|
||||
hpos = w + 256;
|
||||
*dst++ = src[hpos++];
|
||||
*dst++ = src[hpos];
|
||||
|
||||
hpos = w + 512;
|
||||
*dst++ = src[hpos++];
|
||||
*dst++ = src[hpos];
|
||||
|
||||
hpos = w + 768;
|
||||
*dst++ = src[hpos++];
|
||||
*dst++ = src[hpos];
|
||||
|
||||
}
|
||||
|
||||
src += GFX.Pitch;
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
MakeTexture ((char *) GFX.Screen, (char *) texturemem, vwidth, vheight);
|
||||
|
||||
#endif
|
||||
|
||||
DCFlushRange (texturemem, TEX_WIDTH * TEX_HEIGHT * 2);
|
||||
|
||||
GX_SetNumChans (1);
|
||||
|
||||
GX_LoadTexObj (&texobj, GX_TEXMAP0);
|
||||
|
||||
draw_square (view);
|
||||
|
||||
GX_DrawDone ();
|
||||
VIDEO_SetNextFramebuffer (xfb[whichfb]);
|
||||
VIDEO_Flush ();
|
||||
copynow = GX_TRUE;
|
||||
|
||||
#ifdef VIDEO_THREADING
|
||||
/* Return to caller, don't waste time waiting for vb */
|
||||
LWP_ResumeThread (vbthread);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
zoom (float speed)
|
||||
{
|
||||
Vector v;
|
||||
|
||||
v.x = cam.view.x - cam.pos.x;
|
||||
v.y = cam.view.y - cam.pos.y;
|
||||
v.z = cam.view.z - cam.pos.z;
|
||||
|
||||
cam.pos.x += v.x * speed;
|
||||
cam.pos.z += v.z * speed;
|
||||
cam.view.x += v.x * speed;
|
||||
cam.view.z += v.z * speed;
|
||||
|
||||
oldvheight = 0;
|
||||
}
|
23
source/ngc/video.h
Normal file
23
source/ngc/video.h
Normal file
@ -0,0 +1,23 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.50
|
||||
*
|
||||
* Nintendo Gamecube Video
|
||||
*
|
||||
* This is a modified renderer from the Genesis Plus Project.
|
||||
* Well - you didn't expect me to write another one did ya ? -;)
|
||||
*
|
||||
* softdev July 2006
|
||||
****************************************************************************/
|
||||
#ifndef _GCVIDEOH_
|
||||
|
||||
#define _GCVIDEOH_
|
||||
#include "snes9x.h"
|
||||
|
||||
void InitGCVideo ();
|
||||
void clearscreen ();
|
||||
void showscreen ();
|
||||
void setGFX ();
|
||||
void update_video (int width, int height);
|
||||
void zoom (float speed);
|
||||
|
||||
#endif
|
726
source/smb/DES.c
Normal file
726
source/smb/DES.c
Normal file
@ -0,0 +1,726 @@
|
||||
/* ========================================================================== **
|
||||
*
|
||||
* DES.c
|
||||
*
|
||||
* Copyright:
|
||||
* Copyright (C) 2003, 2004 by Christopher R. Hertel
|
||||
*
|
||||
* Email: crh@ubiqx.mn.org
|
||||
*
|
||||
* $Id: DES.c,v 0.6 2004/05/30 05:41:20 crh Exp $
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Implements DES encryption, but not decryption.
|
||||
* DES is used to create LM password hashes and both LM and NTLM Responses.
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* This implementation was created by studying many existing examples
|
||||
* found in Open Source, in the public domain, and in various documentation.
|
||||
* The SMB protocol makes minimal use of the DES function, so this is a
|
||||
* minimal implementation. That which is not required has been removed.
|
||||
*
|
||||
* The SMB protocol uses the DES algorithm as a hash function, not an
|
||||
* encryption function. The auth_DEShash() implemented here is a one-way
|
||||
* function. The reverse is not implemented in this module. Also, there
|
||||
* is no attempt at making this either fast or efficient. There is no
|
||||
* need, as the auth_DEShash() function is used for generating the LM
|
||||
* Response from a 7-byte key and an 8-byte challenge. It is not intended
|
||||
* for use in encrypting large blocks of data or data streams.
|
||||
*
|
||||
* As stated above, this implementation is based on studying existing work
|
||||
* in the public domain or under Open Source (specifically LGPL) license.
|
||||
* The code, however, is written from scratch. Obviously, I make no claim
|
||||
* with regard to those earlier works (except to claim that I am grateful
|
||||
* to the previous implementors whose work I studied). See the list of
|
||||
* references below for resources I used.
|
||||
*
|
||||
* References:
|
||||
* I read through the libmcrypt code to see how they put the pieces
|
||||
* together. See: http://mcrypt.hellug.gr/
|
||||
* Libmcrypt is available under the terms of the LGPL.
|
||||
*
|
||||
* The libmcrypt implementation includes the following credits:
|
||||
* written 12 Dec 1986 by Phil Karn, KA9Q; large sections adapted
|
||||
* from the 1977 public-domain program by Jim Gillogly
|
||||
* Modified for additional speed - 6 December 1988 Phil Karn
|
||||
* Modified for parameterized key schedules - Jan 1991 Phil Karn
|
||||
* modified in order to use the libmcrypt API by Nikos Mavroyanopoulos
|
||||
* All modifications are placed under the license of libmcrypt.
|
||||
*
|
||||
* See also Phil Karn's privacy and security page:
|
||||
* http://www.ka9q.net/privacy.html
|
||||
*
|
||||
* I relied heavily upon:
|
||||
* Applied Cryptography, Second Edition:
|
||||
* Protocols, Algorithms, and Source Code in C
|
||||
* by Bruce Schneier. ISBN 0-471-11709-9, John Wiley & Sons, Inc., 1996
|
||||
* Particularly Chapter 12.
|
||||
*
|
||||
* Here's one more DES resource, which I found quite helpful (aside from
|
||||
* the Clinton jokes):
|
||||
* http://www.aci.net/kalliste/des.htm
|
||||
*
|
||||
* Finally, the use of DES in SMB is covered in:
|
||||
* Implementing CIFS - the Common Internet File System
|
||||
* by your truly. ISBN 0-13-047116-X, Prentice Hall PTR., August 2003
|
||||
* Section 15.3, in particular.
|
||||
* (Online at: http://ubiqx.org/cifs/SMB.html#SMB.8.3)
|
||||
*
|
||||
* ========================================================================== **
|
||||
*/
|
||||
|
||||
#include "DES.h"
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- **
|
||||
* Static Constants:
|
||||
*/
|
||||
|
||||
/* Initial permutation map.
|
||||
* In the first step of DES, the bits of the initial plaintext are rearranged
|
||||
* according to the map given below. This map and those like it are read by
|
||||
* the Permute() function (below) which uses the maps as a guide when moving
|
||||
* bits from one place to another.
|
||||
*
|
||||
* Note that the values here are all one less than those shown in Schneier.
|
||||
* That's because C likes to start counting from 0, not 1.
|
||||
*
|
||||
* According to Schneier (Ch12, pg 271), the purpose of the initial
|
||||
* permutation was to make it easier to load plaintext and ciphertext into
|
||||
* a DES ecryption chip. I have no idea why that would be the case.
|
||||
*/
|
||||
static const uint8_t InitialPermuteMap[64] =
|
||||
{
|
||||
57, 49, 41, 33, 25, 17, 9, 1,
|
||||
59, 51, 43, 35, 27, 19, 11, 3,
|
||||
61, 53, 45, 37, 29, 21, 13, 5,
|
||||
63, 55, 47, 39, 31, 23, 15, 7,
|
||||
56, 48, 40, 32, 24, 16, 8, 0,
|
||||
58, 50, 42, 34, 26, 18, 10, 2,
|
||||
60, 52, 44, 36, 28, 20, 12, 4,
|
||||
62, 54, 46, 38, 30, 22, 14, 6
|
||||
};
|
||||
|
||||
|
||||
/* Key permutation map.
|
||||
* Like the input data and encryption result, the key is permuted before
|
||||
* the algorithm really gets going. The original algorithm called for an
|
||||
* eight-byte key in which each byte contained a parity bit. During the
|
||||
* key permutiation, the parity bits were discarded. The DES algorithm,
|
||||
* as used with SMB, does not make use of the parity bits. Instead, SMB
|
||||
* passes 7-byte keys to DES. For DES implementations that expect parity,
|
||||
* the parity bits must be added. In this case, however, we're just going
|
||||
* to start with a 7-byte (56 bit) key. KeyPermuteMap, below, is adjusted
|
||||
* accordingly and, of course, each entry in the map is reduced by 1 with
|
||||
* respect to the documented values because C likes to start counting from
|
||||
* 0, not 1.
|
||||
*/
|
||||
static const uint8_t KeyPermuteMap[56] =
|
||||
{
|
||||
49, 42, 35, 28, 21, 14, 7, 0,
|
||||
50, 43, 36, 29, 22, 15, 8, 1,
|
||||
51, 44, 37, 30, 23, 16, 9, 2,
|
||||
52, 45, 38, 31, 55, 48, 41, 34,
|
||||
27, 20, 13, 6, 54, 47, 40, 33,
|
||||
26, 19, 12, 5, 53, 46, 39, 32,
|
||||
25, 18, 11, 4, 24, 17, 10, 3,
|
||||
};
|
||||
|
||||
|
||||
/* Key rotation table.
|
||||
* At the start of each round of encryption, the key is split and each
|
||||
* 28-bit half is rotated left. The number of bits of rotation per round
|
||||
* is given in the table below.
|
||||
*/
|
||||
static const uint8_t KeyRotation[16] =
|
||||
{ 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 };
|
||||
|
||||
|
||||
/* Key compression table.
|
||||
* This table is used to select 48 of the 56 bits of the key.
|
||||
* The left and right halves of the source text are each 32 bits,
|
||||
* but they are expanded to 48 bits and the results are XOR'd
|
||||
* against the compressed (48-bit) key.
|
||||
*/
|
||||
static const uint8_t KeyCompression[48] =
|
||||
{
|
||||
13, 16, 10, 23, 0, 4, 2, 27,
|
||||
14, 5, 20, 9, 22, 18, 11, 3,
|
||||
25, 7, 15, 6, 26, 19, 12, 1,
|
||||
40, 51, 30, 36, 46, 54, 29, 39,
|
||||
50, 44, 32, 47, 43, 48, 38, 55,
|
||||
33, 52, 45, 41, 49, 35, 28, 31
|
||||
};
|
||||
|
||||
|
||||
/* Data expansion table.
|
||||
* This table is used after the data block (64-bits) has been split
|
||||
* into two 32-bit (4-byte) halves (generally denoted L and R).
|
||||
* Each 32-bit half is "expanded", using this table, to a 48 bit
|
||||
* data block, which is then XOR'd with the 48 bit subkey for the
|
||||
* round.
|
||||
*/
|
||||
static const uint8_t DataExpansion[48] =
|
||||
{
|
||||
31, 0, 1, 2, 3, 4, 3, 4,
|
||||
5, 6, 7, 8, 7, 8, 9, 10,
|
||||
11, 12, 11, 12, 13, 14, 15, 16,
|
||||
15, 16, 17, 18, 19, 20, 19, 20,
|
||||
21, 22, 23, 24, 23, 24, 25, 26,
|
||||
27, 28, 27, 28, 29, 30, 31, 0
|
||||
};
|
||||
|
||||
|
||||
/* The (in)famous S-boxes.
|
||||
* These are used to perform substitutions.
|
||||
* Six bits worth of input will return four bits of output.
|
||||
* The four bit values are stored in these tables. Each table has
|
||||
* 64 entries...and 6 bits provides a number between 0 and 63.
|
||||
* There are eight S-boxes, one per 6 bits of a 48-bit value.
|
||||
* Thus, 48 bits are reduced to 32 bits. Obviously, this step
|
||||
* follows the DataExpansion step.
|
||||
*
|
||||
* Note that the literature generally shows this as 8 arrays each
|
||||
* with four rows and 16 colums. There is a complex formula for
|
||||
* mapping the 6 bit input values to the correct row and column.
|
||||
* I've pre-computed that mapping, and the tables below provide
|
||||
* direct 6-bit input to 4-bit output. See pp 274-274 in Schneier.
|
||||
*/
|
||||
static const uint8_t SBox[8][64] =
|
||||
{
|
||||
{ /* S0 */
|
||||
14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
|
||||
3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
|
||||
4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
|
||||
15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13
|
||||
},
|
||||
{ /* S1 */
|
||||
15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
|
||||
9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
|
||||
0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
|
||||
5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9
|
||||
},
|
||||
{ /* S2 */
|
||||
10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
|
||||
1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
|
||||
13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
|
||||
11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12
|
||||
},
|
||||
{ /* S3 */
|
||||
7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
|
||||
1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
|
||||
10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
|
||||
15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14
|
||||
},
|
||||
{ /* S4 */
|
||||
2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
|
||||
8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
|
||||
4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
|
||||
15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3
|
||||
},
|
||||
{ /* S5 */
|
||||
12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
|
||||
0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
|
||||
9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
|
||||
7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13
|
||||
},
|
||||
{ /* S6 */
|
||||
4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
|
||||
3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
|
||||
1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
|
||||
10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12
|
||||
},
|
||||
{ /* S7 */
|
||||
13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
|
||||
10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
|
||||
7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
|
||||
0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* P-Box permutation.
|
||||
* This permutation is applied to the result of the S-Box Substitutions.
|
||||
* It's a straight-forward re-arrangement of the bits.
|
||||
*/
|
||||
static const uint8_t PBox[32] =
|
||||
{
|
||||
15, 6, 19, 20, 28, 11, 27, 16,
|
||||
0, 14, 22, 25, 4, 17, 30, 9,
|
||||
1, 7, 23, 13, 31, 26, 2, 8,
|
||||
18, 12, 29, 5, 21, 10, 3, 24
|
||||
};
|
||||
|
||||
|
||||
/* Final permutation map.
|
||||
* This is supposed to be the inverse of the Initial Permutation,
|
||||
* but there's been a bit of fiddling done.
|
||||
* As always, the values given are one less than those in the literature
|
||||
* (because C starts counting from 0, not 1). In addition, the penultimate
|
||||
* step in DES is to swap the left and right hand sides of the ciphertext.
|
||||
* The inverse of the Initial Permutation is then applied to produce the
|
||||
* final result.
|
||||
* To save a step, the map below does the left/right swap as well as the
|
||||
* inverse permutation.
|
||||
*/
|
||||
static const uint8_t FinalPermuteMap[64] =
|
||||
{
|
||||
7, 39, 15, 47, 23, 55, 31, 63,
|
||||
6, 38, 14, 46, 22, 54, 30, 62,
|
||||
5, 37, 13, 45, 21, 53, 29, 61,
|
||||
4, 36, 12, 44, 20, 52, 28, 60,
|
||||
3, 35, 11, 43, 19, 51, 27, 59,
|
||||
2, 34, 10, 42, 18, 50, 26, 58,
|
||||
1, 33, 9, 41, 17, 49, 25, 57,
|
||||
0, 32, 8, 40, 16, 48, 24, 56
|
||||
};
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- **
|
||||
* Macros:
|
||||
*
|
||||
* CLRBIT( STR, IDX )
|
||||
* Input: STR - (uchar *) pointer to an array of 8-bit bytes.
|
||||
* IDX - (int) bitwise index of a bit within the STR array
|
||||
* that is to be cleared (that is, given a value of 0).
|
||||
* Notes: This macro clears a bit within an array of bits (which is
|
||||
* built within an array of bytes).
|
||||
* - The macro converts to an assignment of the form A &= B.
|
||||
* - The string of bytes is viewed as an array of bits, read from
|
||||
* highest order bit first. The highest order bit of a byte
|
||||
* would, therefore, be bit 0 (within that byte).
|
||||
*
|
||||
* SETBIT( STR, IDX )
|
||||
* Input: STR - (uchar *) pointer to an array of 8-bit bytes.
|
||||
* IDX - (int) bitwise index of a bit within the STR array
|
||||
* that is to be set (that is, given a value of 1).
|
||||
* Notes: This macro sets a bit within an array of bits (which is
|
||||
* built within an array of bytes).
|
||||
* - The macro converts to an assignment of the form A |= B.
|
||||
* - The string of bytes is viewed as an array of bits, read from
|
||||
* highest order bit first. The highest order bit of a byte
|
||||
* would, therefore, be bit 0 (within that byte).
|
||||
*
|
||||
* GETBIT( STR, IDX )
|
||||
* Input: STR - (uchar *) pointer to an array of 8-bit bytes.
|
||||
* IDX - (int) bit-wise index of a bit within the STR array
|
||||
* that is to be read.
|
||||
* Output: True (1) if the indexed bit was set, else false (0).
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*/
|
||||
|
||||
#define CLRBIT( STR, IDX ) ( (STR)[(IDX)/8] &= ~(0x01 << (7 - ((IDX)%8))) )
|
||||
|
||||
#define SETBIT( STR, IDX ) ( (STR)[(IDX)/8] |= (0x01 << (7 - ((IDX)%8))) )
|
||||
|
||||
#define GETBIT( STR, IDX ) (( ((STR)[(IDX)/8]) >> (7 - ((IDX)%8)) ) & 0x01)
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- **
|
||||
* Static Functions:
|
||||
*/
|
||||
|
||||
static void Permute( uchar *dst,
|
||||
const uchar *src,
|
||||
const uint8_t *map,
|
||||
const int mapsize )
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* Performs a DES permutation, which re-arranges the bits in an array of
|
||||
* bytes.
|
||||
*
|
||||
* Input: dst - Destination into which to put the re-arranged bits.
|
||||
* src - Source from which to read the bits.
|
||||
* map - Permutation map.
|
||||
* mapsize - Number of bytes represented by the <map>. This also
|
||||
* represents the number of bytes to be copied to <dst>.
|
||||
*
|
||||
* Output: none.
|
||||
*
|
||||
* Notes: <src> and <dst> must not point to the same location.
|
||||
*
|
||||
* - No checks are done to ensure that there is enough room
|
||||
* in <dst>, or that the bit numbers in <map> do not exceed
|
||||
* the bits available in <src>. A good reason to make this
|
||||
* function static (private).
|
||||
*
|
||||
* - The <mapsize> value is in bytes. All permutations in DES
|
||||
* use tables that are a multiple of 8 bits, so there is no
|
||||
* need to handle partial bytes. (Yes, I know that there
|
||||
* are some machines out there that still use bytes of a size
|
||||
* other than 8 bits. For our purposes we'll stick with 8-bit
|
||||
* bytes.)
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
{
|
||||
int bitcount;
|
||||
int i;
|
||||
|
||||
/* Clear all bits in the destination.
|
||||
*/
|
||||
for( i = 0; i < mapsize; i++ )
|
||||
dst[i] = 0;
|
||||
|
||||
/* Set destination bit if the mapped source bit it set. */
|
||||
bitcount = mapsize * 8;
|
||||
for( i = 0; i < bitcount; i++ )
|
||||
{
|
||||
if( GETBIT( src, map[i] ) )
|
||||
SETBIT( dst, i );
|
||||
}
|
||||
} /* Permute */
|
||||
|
||||
|
||||
static void KeyShift( uchar *key, const int numbits )
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* Split the 56-bit key in half & left rotate each half by <numbits> bits.
|
||||
*
|
||||
* Input: key - The 56-bit key to be split-rotated.
|
||||
* numbits - The number of bits by which to rotate the key.
|
||||
*
|
||||
* Output: none.
|
||||
*
|
||||
* Notes: There are probably several better ways to implement this.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
uchar keep = key[0]; /* Copy the highest order bits of the key. */
|
||||
|
||||
/* Repeat the shift process <numbits> times.
|
||||
*/
|
||||
for( i = 0; i < numbits; i++ )
|
||||
{
|
||||
int j;
|
||||
|
||||
/* Shift the entire thing, byte by byte.
|
||||
*/
|
||||
for( j = 0; j < 7; j++ )
|
||||
{
|
||||
if( j && (key[j] & 0x80) ) /* If the top bit of this byte is set. */
|
||||
key[j-1] |= 0x01; /* ...shift it to last byte's low bit. */
|
||||
key[j] <<= 1; /* Then left-shift the whole byte. */
|
||||
}
|
||||
|
||||
/* Now move the high-order bits of each 28-bit half-key to their
|
||||
* correct locations.
|
||||
* Bit 27 is the lowest order bit of the first half-key.
|
||||
* Before the shift, it was the highest order bit of the 2nd half-key.
|
||||
*/
|
||||
if( GETBIT( key, 27 ) ) /* If bit 27 is set... */
|
||||
{
|
||||
CLRBIT( key, 27 ); /* ...clear bit 27. */
|
||||
SETBIT( key, 55 ); /* ...set lowest order bit of 2nd half-key. */
|
||||
}
|
||||
|
||||
/* We kept the highest order bit of the first half-key in <keep>.
|
||||
* If it's set, copy it to bit 27.
|
||||
*/
|
||||
if( keep & 0x80 )
|
||||
SETBIT( key, 27 );
|
||||
|
||||
/* Rotate the <keep> byte too, in case <numbits> is 2 and there's
|
||||
* a second round coming.
|
||||
*/
|
||||
keep <<= 1;
|
||||
}
|
||||
} /* KeyShift */
|
||||
|
||||
|
||||
static void sbox( uchar *dst, const uchar *src )
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* Perform S-Box substitutions.
|
||||
*
|
||||
* Input: dst - Destination byte array into which the S-Box substituted
|
||||
* bitmap will be written.
|
||||
* src - Source byte array.
|
||||
*
|
||||
* Output: none.
|
||||
*
|
||||
* Notes: It's really not possible (for me, anyway) to understand how
|
||||
* this works without reading one or more detailed explanations.
|
||||
* Quick overview, though:
|
||||
*
|
||||
* After the DataExpansion step (in which a 32-bit bit array is
|
||||
* expanded to a 48-bit bit array) the expanded data block is
|
||||
* XOR'd with 48-bits worth of key. That 48 bits then needs to
|
||||
* be condensed back into 32 bits.
|
||||
*
|
||||
* The S-Box substitution handles the data reduction by breaking
|
||||
* the 48-bit value into eight 6-bit values. For each of these
|
||||
* 6-bit values there is a table (an S-Box table). The table
|
||||
* contains 64 possible values. Conveniently, a 6-bit integer
|
||||
* can represent a value between 0 and 63.
|
||||
*
|
||||
* So, if you think of the 48-bit bit array as an array of 6-bit
|
||||
* integers, you use S-Box table 0 with the 0th 6-bit value.
|
||||
* Table 1 is used with the 6-bit value #1, and so on until #7.
|
||||
* Within each table, the correct substitution is found based
|
||||
* simply on the value of the 6-bit integer.
|
||||
*
|
||||
* Well, the original algorithm (and most documentation) don't
|
||||
* make it so simple. There's a complex formula for mapping
|
||||
* the 6-bit values to the correct substitution. Fortunately,
|
||||
* those lookups can be precomputed (and have been for this
|
||||
* implementation). See pp 274-274 in Schneier.
|
||||
*
|
||||
* Oh, and the substitute values are all 4-bit values, so each
|
||||
* 6-bits gets reduced to 4-bits resulting in a 32-bit bit array.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Clear the destination array.
|
||||
*/
|
||||
for( i = 0; i < 4; i++ )
|
||||
dst[i] = 0;
|
||||
|
||||
/* For each set of six input bits...
|
||||
*/
|
||||
for( i = 0; i < 8; i++ )
|
||||
{
|
||||
int j;
|
||||
int Snum;
|
||||
int bitnum;
|
||||
|
||||
/* Extract the 6-bit integer from the source.
|
||||
* This will be the lookup key within the SBox[i] array.
|
||||
*/
|
||||
for( Snum = j = 0, bitnum = (i * 6); j < 6; j++, bitnum++ )
|
||||
{
|
||||
Snum <<= 1;
|
||||
Snum |= GETBIT( src, bitnum );
|
||||
}
|
||||
|
||||
/* Find the correct value in the correct SBox[]
|
||||
* and copy it into the destination.
|
||||
* Left shift the nibble four bytes for even values of <i>.
|
||||
*/
|
||||
if( 0 == (i%2) )
|
||||
dst[i/2] |= ((SBox[i][Snum]) << 4);
|
||||
else
|
||||
dst[i/2] |= SBox[i][Snum];
|
||||
}
|
||||
} /* sbox */
|
||||
|
||||
|
||||
static void xor( uchar *dst, const uchar *a, const uchar *b, const int count )
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* Perform an XOR operation on two byte arrays.
|
||||
*
|
||||
* Input: dst - Destination array to which the result will be written.
|
||||
* a - The first string of bytes.
|
||||
* b - The second string of bytes.
|
||||
* count - Number of bytes to XOR against one another.
|
||||
*
|
||||
* Output: none.
|
||||
*
|
||||
* Notes: This function operates on whole byte chunks. There's no need
|
||||
* to XOR partial bytes so no need to write code to handle it.
|
||||
*
|
||||
* - This function essentially implements dst = a ^ b; for byte
|
||||
* arrays.
|
||||
*
|
||||
* - <dst> may safely point to the same location as <a> or <b>.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < count; i++ )
|
||||
dst[i] = a[i] ^ b[i];
|
||||
} /* xor */
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- **
|
||||
* Functions:
|
||||
*/
|
||||
|
||||
uchar *auth_DESkey8to7( uchar *dst, const uchar *key )
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* Compress an 8-byte DES key to its 7-byte form.
|
||||
*
|
||||
* Input: dst - Pointer to a memory location (minimum 7 bytes) to accept
|
||||
* the compressed key.
|
||||
* key - Pointer to an 8-byte DES key. See the notes below.
|
||||
*
|
||||
* Output: A pointer to the compressed key (same as <dst>) or NULL if
|
||||
* either <src> or <dst> were NULL.
|
||||
*
|
||||
* Notes: There are no checks done to ensure that <dst> and <key> point
|
||||
* to sufficient space. Please be carefull.
|
||||
*
|
||||
* The two pointers, <dst> and <key> may point to the same
|
||||
* memory location. Internally, a temporary buffer is used and
|
||||
* the results are copied back to <dst>.
|
||||
*
|
||||
* The DES algorithm uses 8 byte keys by definition. The first
|
||||
* step in the algorithm, however, involves removing every eigth
|
||||
* bit to produce a 56-bit key (seven bytes). SMB authentication
|
||||
* skips this step and uses 7-byte keys. The <auth_DEShash()>
|
||||
* algorithm in this module expects 7-byte keys. This function
|
||||
* is used to convert an 8-byte DES key into a 7-byte SMB DES key.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
uchar tmp[7];
|
||||
static const uint8_t map8to7[56] =
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6,
|
||||
8, 9, 10, 11, 12, 13, 14,
|
||||
16, 17, 18, 19, 20, 21, 22,
|
||||
24, 25, 26, 27, 28, 29, 30,
|
||||
32, 33, 34, 35, 36, 37, 38,
|
||||
40, 41, 42, 43, 44, 45, 46,
|
||||
48, 49, 50, 51, 52, 53, 54,
|
||||
56, 57, 58, 59, 60, 61, 62
|
||||
};
|
||||
|
||||
if( (NULL == dst) || (NULL == key) )
|
||||
return( NULL );
|
||||
|
||||
Permute( tmp, key, map8to7, 7 );
|
||||
for( i = 0; i < 7; i++ )
|
||||
dst[i] = tmp[i];
|
||||
|
||||
return( dst );
|
||||
} /* auth_DESkey8to7 */
|
||||
|
||||
|
||||
uchar *auth_DEShash( uchar *dst, const uchar *key, const uchar *src )
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* DES encryption of the input data using the input key.
|
||||
*
|
||||
* Input: dst - Destination buffer. It *must* be at least eight bytes
|
||||
* in length, to receive the encrypted result.
|
||||
* key - Encryption key. Exactly seven bytes will be used.
|
||||
* If your key is shorter, ensure that you pad it to seven
|
||||
* bytes.
|
||||
* src - Source data to be encrypted. Exactly eight bytes will
|
||||
* be used. If your source data is shorter, ensure that
|
||||
* you pad it to eight bytes.
|
||||
*
|
||||
* Output: A pointer to the encrpyted data (same as <dst>).
|
||||
*
|
||||
* Notes: In SMB, the DES function is used as a hashing function rather
|
||||
* than an encryption/decryption tool. When used for generating
|
||||
* the LM hash the <src> input is the known value "KGS!@#$%" and
|
||||
* the key is derived from the password entered by the user.
|
||||
* When used to generate the LM or NTLM response, the <key> is
|
||||
* derived from the LM or NTLM hash, and the challenge is used
|
||||
* as the <src> input.
|
||||
* See: http://ubiqx.org/cifs/SMB.html#SMB.8.3
|
||||
*
|
||||
* - This function is called "DEShash" rather than just "DES"
|
||||
* because it is only used for creating LM hashes and the
|
||||
* LM/NTLM responses. For all practical purposes, however, it
|
||||
* is a full DES encryption implementation.
|
||||
*
|
||||
* - This DES implementation does not need to be fast, nor is a
|
||||
* DES decryption function needed. The goal is to keep the
|
||||
* code small, simple, and well documented.
|
||||
*
|
||||
* - The input values are copied and refiddled within the module
|
||||
* and the result is not written to <dst> until the very last
|
||||
* step, so it's okay if <dst> points to the same memory as
|
||||
* <key> or <src>.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
{
|
||||
int i; /* Loop counter. */
|
||||
uchar K[7]; /* Holds the key, as we manipulate it. */
|
||||
uchar D[8]; /* The data block, as we manipulate it. */
|
||||
|
||||
/* Create the permutations of the key and the source.
|
||||
*/
|
||||
Permute( K, key, KeyPermuteMap, 7 );
|
||||
Permute( D, src, InitialPermuteMap, 8 );
|
||||
|
||||
/* DES encryption proceeds in 16 rounds.
|
||||
* The stuff inside the loop is known in the literature as "function f".
|
||||
*/
|
||||
for( i = 0; i < 16; i++ )
|
||||
{
|
||||
int j;
|
||||
uchar *L = D; /* The left 4 bytes (half) of the data block. */
|
||||
uchar *R = &(D[4]); /* The right half of the ciphertext block. */
|
||||
uchar Rexp[6]; /* Expanded right half. */
|
||||
uchar Rn[4]; /* New value of R, as we manipulate it. */
|
||||
uchar SubK[6]; /* The 48-bit subkey. */
|
||||
|
||||
/* Generate the subkey for this round.
|
||||
*/
|
||||
KeyShift( K, KeyRotation[i] );
|
||||
Permute( SubK, K, KeyCompression, 6 );
|
||||
|
||||
/* Expand the right half (R) of the data block to 48 bytes,
|
||||
* then XOR the result with the Subkey for this round.
|
||||
*/
|
||||
Permute( Rexp, R, DataExpansion, 6 );
|
||||
xor( Rexp, Rexp, SubK, 6 );
|
||||
|
||||
/* S-Box substitutions, P-Box permutation, and final XOR.
|
||||
* The S-Box substitutions return a 32-bit value, which is then
|
||||
* run through the 32-bit to 32-bit P-Box permutation. The P-Box
|
||||
* result is then XOR'd with the left-hand half of the key.
|
||||
* (Rexp is used as a temporary variable between the P-Box & XOR).
|
||||
*/
|
||||
sbox( Rn, Rexp );
|
||||
Permute( Rexp, Rn, PBox, 4 );
|
||||
xor( Rn, L, Rexp, 4 );
|
||||
|
||||
/* The previous R becomes the new L,
|
||||
* and Rn is moved into R ready for the next round.
|
||||
*/
|
||||
for( j = 0; j < 4; j++ )
|
||||
{
|
||||
L[j] = R[j];
|
||||
R[j] = Rn[j];
|
||||
}
|
||||
}
|
||||
|
||||
/* The encryption is complete.
|
||||
* Now reverse-permute the ciphertext to produce the final result.
|
||||
* We actually combine two steps here. The penultimate step is to
|
||||
* swap the positions of L and R in the result of the 16 rounds,
|
||||
* after which the reverse of the Initial Permutation is applied.
|
||||
* To save a step, the FinalPermuteMap applies both the L/R swap
|
||||
* and the inverse of the Initial Permutation.
|
||||
*/
|
||||
Permute( dst, D, FinalPermuteMap, 8 );
|
||||
return( dst );
|
||||
} /* auth_DEShash */
|
||||
|
||||
/* ========================================================================== */
|
179
source/smb/DES.h
Normal file
179
source/smb/DES.h
Normal file
@ -0,0 +1,179 @@
|
||||
#ifndef AUTH_DES_H
|
||||
#define AUTH_DES_H
|
||||
/* ========================================================================== **
|
||||
*
|
||||
* DES.h
|
||||
*
|
||||
* Copyright:
|
||||
* Copyright (C) 2003, 2004 by Christopher R. Hertel
|
||||
*
|
||||
* Email: crh@ubiqx.mn.org
|
||||
*
|
||||
* $Id: DES.h,v 0.5 2004/05/30 02:31:47 crh Exp $
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Implements DES encryption, but not decryption.
|
||||
* DES is used to create LM password hashes and both LM and NTLM Responses.
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* This implementation was created by studying many existing examples
|
||||
* found in Open Source, in the public domain, and in various documentation.
|
||||
* The SMB protocol makes minimal use of the DES function, so this is a
|
||||
* minimal implementation. That which is not required has been removed.
|
||||
*
|
||||
* The SMB protocol uses the DES algorithm as a hash function, not an
|
||||
* encryption function. The auth_DEShash() implemented here is a one-way
|
||||
* function. The reverse is not implemented in this module. Also, there
|
||||
* is no attempt at making this either fast or efficient. There is no
|
||||
* need, as the auth)DEShash() function is used for generating the LM
|
||||
* Response from a 7-byte key and an 8-byte challenge. It is not intended
|
||||
* for use in encrypting large blocks of data or data streams.
|
||||
*
|
||||
* As stated above, this implementation is based on studying existing work
|
||||
* in the public domain or under Open Source (specifically LGPL) license.
|
||||
* The code, however, is written from scratch. Obviously, I make no claim
|
||||
* with regard to those earlier works (except to claim that I am grateful
|
||||
* to the previous implementors whose work I studied). See the list of
|
||||
* references below for resources I used.
|
||||
*
|
||||
* References:
|
||||
* I read through the libmcrypt code to see how they put the pieces
|
||||
* together. See: http://mcrypt.hellug.gr/
|
||||
* Libmcrypt is available under the terms of the LGPL.
|
||||
*
|
||||
* The libmcrypt implementation includes the following credits:
|
||||
* written 12 Dec 1986 by Phil Karn, KA9Q; large sections adapted
|
||||
* from the 1977 public-domain program by Jim Gillogly
|
||||
* Modified for additional speed - 6 December 1988 Phil Karn
|
||||
* Modified for parameterized key schedules - Jan 1991 Phil Karn
|
||||
* modified in order to use the libmcrypt API by Nikos Mavroyanopoulos
|
||||
* All modifications are placed under the license of libmcrypt.
|
||||
*
|
||||
* See also Phil Karn's privacy and security page:
|
||||
* http://www.ka9q.net/privacy.html
|
||||
*
|
||||
* I relied heavily upon:
|
||||
* Applied Cryptography, Second Edition:
|
||||
* Protocols, Algorithms, and Source Code in C
|
||||
* by Bruce Schneier. ISBN 0-471-11709-9, John Wiley & Sons, Inc., 1996
|
||||
* Particularly Chapter 12.
|
||||
*
|
||||
* Here's one more DES resource, which I found quite helpful (aside from
|
||||
* the Clinton jokes):
|
||||
* http://www.aci.net/kalliste/des.htm
|
||||
*
|
||||
* Finally, the use of DES in SMB is covered in:
|
||||
* Implementing CIFS - the Common Internet File System
|
||||
* by your truly. ISBN 0-13-047116-X, Prentice Hall PTR., August 2003
|
||||
* Section 15.3, in particular.
|
||||
* (Online at: http://ubiqx.org/cifs/SMB.html#SMB.8.3)
|
||||
*
|
||||
* ========================================================================== **
|
||||
*/
|
||||
|
||||
//#include "auth_common.h"
|
||||
#include <stdio.h>
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned char uint8_t;
|
||||
|
||||
/* -------------------------------------------------------------------------- **
|
||||
* Functions:
|
||||
*/
|
||||
|
||||
uchar *auth_DESkey8to7( uchar *dst, const uchar *key );
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* Compress an 8-byte DES key to its 7-byte form.
|
||||
*
|
||||
* Input: dst - Pointer to a memory location (minimum 7 bytes) to accept
|
||||
* the compressed key.
|
||||
* key - Pointer to an 8-byte DES key. See the notes below.
|
||||
*
|
||||
* Output: A pointer to the compressed key (same as <dst>) or NULL if
|
||||
* either <src> or <dst> were NULL.
|
||||
*
|
||||
* Notes: There are no checks done to ensure that <dst> and <key> point
|
||||
* to sufficient space. Please be carefull.
|
||||
*
|
||||
* The two pointers, <dst> and <key> may point to the same
|
||||
* memory location. Internally, a temporary buffer is used and
|
||||
* the results are copied back to <dst>.
|
||||
*
|
||||
* The DES algorithm uses 8 byte keys by definition. The first
|
||||
* step in the algorithm, however, involves removing every eigth
|
||||
* bit to produce a 56-bit key (seven bytes). SMB authentication
|
||||
* skips this step and uses 7-byte keys. The <auth_DEShash()>
|
||||
* algorithm in this module expects 7-byte keys. This function
|
||||
* is used to convert an 8-byte DES key into a 7-byte SMB DES key.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
|
||||
|
||||
uchar *auth_DEShash( uchar *dst, const uchar *key, const uchar *src );
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* DES encryption of the input data using the input key.
|
||||
*
|
||||
* Input: dst - Destination buffer. It *must* be at least eight bytes
|
||||
* in length, to receive the encrypted result.
|
||||
* key - Encryption key. Exactly seven bytes will be used.
|
||||
* If your key is shorter, ensure that you pad it to seven
|
||||
* bytes.
|
||||
* src - Source data to be encrypted. Exactly eight bytes will
|
||||
* be used. If your source data is shorter, ensure that
|
||||
* you pad it to eight bytes.
|
||||
*
|
||||
* Output: A pointer to the encrpyted data (same as <dst>).
|
||||
*
|
||||
* Notes: In SMB, the DES function is used as a hashing function rather
|
||||
* than an encryption/decryption tool. When used for generating
|
||||
* the LM hash the <src> input is the known value "KGS!@#$%" and
|
||||
* the key is derived from the password entered by the user.
|
||||
* When used to generate the LM or NTLM response, the <key> is
|
||||
* derived from the LM or NTLM hash, and the challenge is used
|
||||
* as the <src> input.
|
||||
* See: http://ubiqx.org/cifs/SMB.html#SMB.8.3
|
||||
*
|
||||
* - This function is called "DEShash" rather than just "DES"
|
||||
* because it is only used for creating LM hashes and the
|
||||
* LM/NTLM responses. For all practical purposes, however, it
|
||||
* is a full DES encryption implementation.
|
||||
*
|
||||
* - This DES implementation does not need to be fast, nor is a
|
||||
* DES decryption function needed. The goal is to keep the
|
||||
* code small, simple, and well documented.
|
||||
*
|
||||
* - The input values are copied and refiddled within the module
|
||||
* and the result is not written to <dst> until the very last
|
||||
* step, so it's okay if <dst> points to the same memory as
|
||||
* <key> or <src>.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
|
||||
|
||||
/* ========================================================================== */
|
||||
#endif /* AUTH_DES_H */
|
169
source/smb/LMhash.c
Normal file
169
source/smb/LMhash.c
Normal file
@ -0,0 +1,169 @@
|
||||
/* ========================================================================== **
|
||||
*
|
||||
* LMhash.c
|
||||
*
|
||||
* Copyright:
|
||||
* Copyright (C) 2004 by Christopher R. Hertel
|
||||
*
|
||||
* Email: crh@ubiqx.mn.org
|
||||
*
|
||||
* $Id: LMhash.c,v 0.1 2004/05/30 02:26:31 crh Exp $
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Implemention of the LAN Manager hash (LM hash) and LM response
|
||||
* algorithms.
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* This module implements the LM hash. The NT hash is simply the MD4() of
|
||||
* the password, so we don't need a separate implementation of that. This
|
||||
* module also implements the LM response, which can be combined with the
|
||||
* NT hash to produce the NTLM response.
|
||||
*
|
||||
* This implementation was created based on the description in my own book.
|
||||
* The book description was, in turn, written after studying many existing
|
||||
* examples in various documentation. Jeremy Allison and Andrew Tridgell
|
||||
* deserve lots of credit for having figured out the secrets of Lan Manager
|
||||
* authentication many years ago.
|
||||
*
|
||||
* See:
|
||||
* Implementing CIFS - the Common Internet File System
|
||||
* by your truly. ISBN 0-13-047116-X, Prentice Hall PTR., August 2003
|
||||
* Section 15.3, in particular.
|
||||
* (Online at: http://ubiqx.org/cifs/SMB.html#SMB.8.3)
|
||||
*
|
||||
* ========================================================================== **
|
||||
*/
|
||||
|
||||
#include "DES.h"
|
||||
#include "LMhash.h"
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- **
|
||||
* Static Constants:
|
||||
*
|
||||
* SMB_LMhash_Magic - This is the plaintext "magic string" that is used to
|
||||
* generate the LM Hash from the user's password. This
|
||||
* value was a Microsoft "secret" for many years.
|
||||
*/
|
||||
|
||||
static const uchar SMB_LMhash_Magic[8] =
|
||||
{ 'K', 'G', 'S', '!', '@', '#', '$', '%' };
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- **
|
||||
* Functions:
|
||||
*/
|
||||
|
||||
uchar *auth_LMhash( uchar *dst, const uchar *pwd, const int pwdlen )
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* Generate an LM Hash from the input password.
|
||||
*
|
||||
* Input: dst - Pointer to a location to which to write the LM Hash.
|
||||
* Requires 16 bytes minimum.
|
||||
* pwd - Source password. Should be in OEM charset (extended
|
||||
* ASCII) format in all upper-case, but this
|
||||
* implementation doesn't really care. See the notes
|
||||
* below.
|
||||
* pwdlen - Length, in bytes, of the password. Normally, this
|
||||
* will be strlen( pwd ).
|
||||
*
|
||||
* Output: Pointer to the resulting LM hash (same as <dst>).
|
||||
*
|
||||
* Notes: This function does not convert the input password to upper
|
||||
* case. The upper-case conversion should be done before the
|
||||
* password gets this far. DOS codepage handling and such
|
||||
* should be taken into consideration. Rather than attempt to
|
||||
* work out all those details here, the function assumes that
|
||||
* the password is in the correct form before it reaches this
|
||||
* point.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
{
|
||||
int i,
|
||||
max14;
|
||||
uint8_t tmp_pwd[14] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
|
||||
|
||||
/* Copy at most 14 bytes of <pwd> into <tmp_pwd>.
|
||||
* If the password is less than 14 bytes long
|
||||
* the rest will be nul padded.
|
||||
*/
|
||||
max14 = pwdlen > 14 ? 14 : pwdlen;
|
||||
for( i = 0; i < max14; i++ )
|
||||
tmp_pwd[i] = pwd[i];
|
||||
|
||||
/* The password is split into two 7-byte keys, each of which
|
||||
* are used to DES-encrypt the magic string. The results are
|
||||
* concatonated to produce the 16-byte LM Hash.
|
||||
*/
|
||||
(void)auth_DEShash( dst, tmp_pwd, SMB_LMhash_Magic );
|
||||
(void)auth_DEShash( &dst[8], &tmp_pwd[7], SMB_LMhash_Magic );
|
||||
|
||||
/* Return a pointer to the result.
|
||||
*/
|
||||
return( dst );
|
||||
} /* auth_LMhash */
|
||||
|
||||
|
||||
uchar *auth_LMresponse( uchar *dst, const uchar *hash, const uchar *challenge )
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* Generate the LM (or NTLM) response from the password hash and challenge.
|
||||
*
|
||||
* Input: dst - Pointer to memory into which to write the response.
|
||||
* Must have 24 bytes available.
|
||||
* hash - Pointer to the 16-byte password hash.
|
||||
* challenge - Pointer to the 8-byte challenge.
|
||||
*
|
||||
* Output: A pointer to the 24-byte response (same as <dst>).
|
||||
*
|
||||
* Notes: The function does not check the lengths of the input or output
|
||||
* parameters. The byte sizes given above must be respected by
|
||||
* calling function.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
{
|
||||
uchar tmp[7] =
|
||||
{ hash[14], hash[15], 0,0,0,0,0 }; /* 3rd key is nul-padded. */
|
||||
|
||||
/* It's painfully simple...
|
||||
* The challenge is DES encrypted three times.
|
||||
* The first time, the first 7 bytes of the hash are used.
|
||||
* The second time, the second 7 bytes of the hash are used.
|
||||
* The third time, the two remaining hash bytes plus five nuls are used.
|
||||
* The three 8-byte results are concatonated to form the 24-byte response.
|
||||
*/
|
||||
(void)auth_DEShash( dst, hash, challenge );
|
||||
(void)auth_DEShash( &dst[8], &hash[7], challenge );
|
||||
(void)auth_DEShash( &dst[16], tmp, challenge );
|
||||
|
||||
/* Return the result.
|
||||
*/
|
||||
return( dst );
|
||||
} /* auth_LMresponse */
|
||||
|
||||
/* ========================================================================== */
|
115
source/smb/LMhash.h
Normal file
115
source/smb/LMhash.h
Normal file
@ -0,0 +1,115 @@
|
||||
#ifndef AUTH_LMHASH_H
|
||||
#define AUTH_LMHASH_H
|
||||
/* ========================================================================== **
|
||||
*
|
||||
* LMhash.h
|
||||
*
|
||||
* Copyright:
|
||||
* Copyright (C) 2004 by Christopher R. Hertel
|
||||
*
|
||||
* Email: crh@ubiqx.mn.org
|
||||
*
|
||||
* $Id: LMhash.h,v 0.1 2004/05/30 02:26:31 crh Exp $
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Implemention of the LAN Manager hash (LM hash) and LM response
|
||||
* algorithms.
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* -------------------------------------------------------------------------- **
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* This module implements the LM hash. The NT hash is simply the MD4() of
|
||||
* the password, so we don't need a separate implementation of that. This
|
||||
* module also implements the LM response, which can be combined with the
|
||||
* NT hash to produce the NTLM response.
|
||||
*
|
||||
* This implementation was created based on the description in my own book.
|
||||
* The book description was, in turn, written after studying many existing
|
||||
* examples in various documentation. Jeremy Allison and Andrew Tridgell
|
||||
* deserve lots of credit for having figured out the secrets of Lan Manager
|
||||
* authentication many years ago.
|
||||
*
|
||||
* See:
|
||||
* Implementing CIFS - the Common Internet File System
|
||||
* by your truly. ISBN 0-13-047116-X, Prentice Hall PTR., August 2003
|
||||
* Section 15.3, in particular.
|
||||
* (Online at: http://ubiqx.org/cifs/SMB.html#SMB.8.3)
|
||||
*
|
||||
* ========================================================================== **
|
||||
*/
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- **
|
||||
* Functions:
|
||||
*/
|
||||
|
||||
uchar *auth_LMhash( uchar *dst, const uchar *pwd, const int pwdlen );
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* Generate an LM Hash from the input password.
|
||||
*
|
||||
* Input: dst - Pointer to a location to which to write the LM Hash.
|
||||
* Requires 16 bytes minimum.
|
||||
* pwd - Source password. Should be in OEM charset (extended
|
||||
* ASCII) format in all upper-case, but this
|
||||
* implementation doesn't really care. See the notes
|
||||
* below.
|
||||
* pwdlen - Length, in bytes, of the password. Normally, this
|
||||
* will be strlen( pwd ).
|
||||
*
|
||||
* Output: Pointer to the resulting LM hash (same as <dst>).
|
||||
*
|
||||
* Notes: This function does not convert the input password to upper
|
||||
* case. The upper-case conversion should be done before the
|
||||
* password gets this far. DOS codepage handling and such
|
||||
* should be taken into consideration. Rather than attempt to
|
||||
* work out all those details here, the function assumes that
|
||||
* the password is in the correct form before it reaches this
|
||||
* point.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
|
||||
|
||||
uchar *auth_LMresponse( uchar *dst, const uchar *hash, const uchar *challenge );
|
||||
/* ------------------------------------------------------------------------ **
|
||||
* Generate the LM (or NTLM) response from the password hash and challenge.
|
||||
*
|
||||
* Input: dst - Pointer to memory into which to write the response.
|
||||
* Must have 24 bytes available.
|
||||
* hash - Pointer to the 16-byte password hash.
|
||||
* challenge - Pointer to the 8-byte challenge.
|
||||
*
|
||||
* Output: A pointer to the 24-byte response (same as <dst>).
|
||||
*
|
||||
* Notes: The function does not check the lengths of the input or output
|
||||
* parameters. The byte sizes given above must be respected by
|
||||
* calling function.
|
||||
*
|
||||
* ------------------------------------------------------------------------ **
|
||||
*/
|
||||
|
||||
|
||||
/* ========================================================================== */
|
||||
#endif /* AUTH_LMHASH_H */
|
112
source/smb/readme1st.txt
Normal file
112
source/smb/readme1st.txt
Normal file
@ -0,0 +1,112 @@
|
||||
TinySMB-GC 0.1
|
||||
May 2006
|
||||
|
||||
Developer Documentation
|
||||
|
||||
What is TinySMB-GC?
|
||||
|
||||
TinySMB-GC is a minimal implementation of the SMB protocol for the Nintendo Gamecube.
|
||||
|
||||
What does it do?
|
||||
|
||||
Essentially, TinySMB-GC enables network share support. This means that it will allow the
|
||||
GameCube to connect to a shared folder on a Windows XP or linux samba box, and perform
|
||||
basic file functions.
|
||||
|
||||
Known Restrictions
|
||||
|
||||
TinySMB-GC only supports the LM1.2X002 protocol. THIS IS NOT THE MOST SECURE!
|
||||
However, it does NOT transmit your password over the wire, so it's reasonably safe.
|
||||
|
||||
How do I use it?
|
||||
|
||||
TinySMB-GC is developed with devkitPPC and libOGC, therefore you should be using this
|
||||
development environment. Put simply, it won't work with anything else!
|
||||
|
||||
TinySMB-GC uses the TCP-raw form of SMB on port 445.
|
||||
|
||||
The Functions.
|
||||
|
||||
int SMB_Init (char *user, /*** The logon user - MUST have share access rights ***/
|
||||
char *password, /*** PLEASE USE PASSWORD SECURITY! ***/
|
||||
char *client, /*** Machine ID, whatever you want to call the GC ***/
|
||||
char *server, /*** Machine ID of share server ***/
|
||||
char *share, /*** Share ID ***/
|
||||
char *IP); /*** IP of share server ***/
|
||||
|
||||
SMB_Init is used to establish the connection, authenticate and attach to the share.
|
||||
Obviously, this must be called successfully before any other function.
|
||||
|
||||
void SMB_Destroy ();
|
||||
|
||||
SMB_Destroy takes care of releasing the internal socket of TinySMB-GC and should be
|
||||
called when the SMB functions are no longer required.
|
||||
|
||||
int SMB_FindFirst (char *filename, /*** The file mask to search for ***/
|
||||
unsigned short flags, /*** Search criteria flags ***/
|
||||
SMBDIRENTRY * sdir); /*** An SMBDIRENTRY to hold directory information ***/
|
||||
|
||||
Similar to MS-Windows, to search for a file or directory, use this function to determine if the
|
||||
file already exists. The SMBDIRENTRY simply holds basic information on each entry retrieved.
|
||||
|
||||
int SMB_FindNext (SMBDIRENTRY * sdir);
|
||||
|
||||
Called to continue a search started with SMB_FindFirst.
|
||||
|
||||
int SMB_FindClose ();
|
||||
|
||||
When all searches have completed, call SMB_FindClose to dispense with the search handle.
|
||||
|
||||
SMBFILE SMB_Open (char *filename, /*** The filename to open ***/
|
||||
unsigned short access, /*** Access method ***/
|
||||
unsigned short creation); /*** Creation flags ***/
|
||||
|
||||
This call will open a file on the share. Both reading and writing are supported.
|
||||
Look at smb.h for information on the access and creation flags.
|
||||
|
||||
void SMB_Close (SMBFILE sfid);
|
||||
|
||||
Close a file previously opened with SMB_Open
|
||||
|
||||
int SMB_Read (char *buffer, int size, int offset, SMBFILE sfile);
|
||||
|
||||
Read from the file opened with SMB_Open.
|
||||
|
||||
int SMB_Write (char *buffer, int size, int offset, SMBFILE sfile);
|
||||
|
||||
Write to the file opened with SMB_Open.
|
||||
|
||||
NOTE: The offset value provides the missing seek function. However, the onus
|
||||
is on the developer to maintain the offset value when reading / writing
|
||||
sequentially.
|
||||
|
||||
You should also be aware that these functions should only be used to read/write
|
||||
blocks up to 62Kbytes. Although it allows reading and writing of 4Gb files, it
|
||||
does not support blocks larger then 16-bit - go figure!
|
||||
|
||||
Credits
|
||||
|
||||
TinySMB-GC Copyright softdev@tehskeen.com
|
||||
Please respect this copyright!
|
||||
NOTE WELL: This software is released under GPL 2.1
|
||||
YOU MAY NOT STEAL IT AND HIDE IT IN YOUR
|
||||
CLOSED SOURCE PRODUCT.
|
||||
|
||||
libOGC shagkur
|
||||
|
||||
devkitPPC wntrmute
|
||||
|
||||
CIFS Info Christopher R Hertel
|
||||
http://www.ubiqx.com
|
||||
Storage Networking Industry Association
|
||||
http://www.snia.com
|
||||
Ethereal - Packet Capture
|
||||
http://www.ethereal.com
|
||||
|
||||
Thanks
|
||||
|
||||
Cedy_NL, for testing and helping get this off the ground.
|
||||
brakken, web hosting and promotion.
|
||||
|
||||
Everyone who has participated in the Genesis Plus Project - keep up the good work !
|
||||
|
932
source/smb/smb.c
Normal file
932
source/smb/smb.c
Normal file
@ -0,0 +1,932 @@
|
||||
/****************************************************************************
|
||||
* TinySMB-GC
|
||||
*
|
||||
* Nintendo Gamecube SaMBa implementation.
|
||||
*
|
||||
* Copyright softdev@tehskeen.com
|
||||
*
|
||||
* Authentication modules, LMhash and DES are
|
||||
*
|
||||
* Copyright Christopher R Hertel.
|
||||
* http://www.ubiqx.org
|
||||
*
|
||||
* You WILL find Ethereal, available from http://www.ethereal.com
|
||||
* invaluable for debugging each new SAMBA implementation.
|
||||
*
|
||||
* Recommended Reading
|
||||
* Implementing CIFS - Christopher R Hertel
|
||||
* SNIA CIFS Documentation - http://www.snia.org
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
****************************************************************************/
|
||||
|
||||
#include <gccore.h>
|
||||
#include <network.h>
|
||||
#include "smb.h"
|
||||
#include "DES.h"
|
||||
#include "LMhash.h"
|
||||
#include <ctype.h>
|
||||
|
||||
/**
|
||||
* A few little bits for libOGC
|
||||
*/
|
||||
typedef int SOCKET;
|
||||
#define recv net_recv
|
||||
#define send net_send
|
||||
#define closesocket net_close
|
||||
#define connect net_connect
|
||||
#define setsockopt net_setsockopt
|
||||
#define socket net_socket
|
||||
|
||||
/**
|
||||
* Client and server SMB
|
||||
*/
|
||||
NBTSMB c;
|
||||
NBTSMB s;
|
||||
SMBSESSION session;
|
||||
SOCKET smbsock;
|
||||
static struct sockaddr_in smbs;
|
||||
static int smbcheckbytes = 0;
|
||||
|
||||
/**
|
||||
* SMB Endian aware supporting functions
|
||||
*
|
||||
* SMB always uses Intel Little-Endian values, so htons etc are
|
||||
* of little or no use :) ... Thanks M$
|
||||
*/
|
||||
/*** get unsigned char ***/
|
||||
static unsigned char
|
||||
getUChar (unsigned char *buffer, int offset)
|
||||
{
|
||||
return buffer[offset];
|
||||
}
|
||||
|
||||
/*** set unsigned char ***/
|
||||
static void
|
||||
setUChar (unsigned char *buffer, int offset, unsigned char value)
|
||||
{
|
||||
buffer[offset] = value;
|
||||
}
|
||||
|
||||
/*** get unsigned short ***/
|
||||
static unsigned short
|
||||
getUShort (unsigned char *buffer, int offset)
|
||||
{
|
||||
unsigned short t;
|
||||
t = buffer[offset];
|
||||
t |= (buffer[offset + 1] << 8);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
/*** set unsigned short ***/
|
||||
static void
|
||||
setUShort (unsigned char *buffer, int offset, unsigned short value)
|
||||
{
|
||||
buffer[offset] = value & 0xff;
|
||||
buffer[offset + 1] = (value & 0xff00) >> 8;
|
||||
}
|
||||
|
||||
/*** get unsigned int ***/
|
||||
static unsigned int
|
||||
getUInt (unsigned char *buffer, int offset)
|
||||
{
|
||||
unsigned int t;
|
||||
|
||||
t = buffer[offset];
|
||||
t |= (buffer[offset + 1] << 8);
|
||||
t |= (buffer[offset + 2] << 16);
|
||||
t |= (buffer[offset + 3] << 24);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
/*** set unsigned int ***/
|
||||
static void
|
||||
setUInt (unsigned char *buffer, int offset, int value)
|
||||
{
|
||||
buffer[offset] = value & 0xff;
|
||||
buffer[offset + 1] = (value & 0xff00) >> 8;
|
||||
buffer[offset + 2] = (value & 0xff0000) >> 16;
|
||||
buffer[offset + 3] = (value & 0xff000000) >> 24;
|
||||
}
|
||||
|
||||
/**
|
||||
* MakeSMBHdr
|
||||
*
|
||||
* Generate the SMB header for each request.
|
||||
* Uses 'c' NBTSMB
|
||||
*/
|
||||
static void
|
||||
MakeSMBHdr (unsigned char command)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
/*** Clear client packet ***/
|
||||
memset (&c, 0, sizeof (c));
|
||||
|
||||
/*** Add protocol SMB ***/
|
||||
setUInt (c.smb, pos, SMB_PROTO);
|
||||
pos += 4;
|
||||
setUChar (c.smb, pos, command);
|
||||
pos++;
|
||||
pos++; /*** Error class ***/
|
||||
pos++; /*** Reserved ***/
|
||||
pos += 2; /*** Error Code ***/
|
||||
setUChar (c.smb, pos, 0x8);
|
||||
pos++; /*** Flags == 8 == Case Insensitive ***/
|
||||
setUShort (c.smb, pos, 0x1);
|
||||
pos += 2; /*** Flags2 == 1 == LFN ***/
|
||||
pos += 2; /*** Process ID High ***/
|
||||
pos += 8; /*** Signature ***/
|
||||
pos += 2; /*** Reserved ***/
|
||||
setUShort (c.smb, pos, session.TID);
|
||||
pos += 2;
|
||||
setUShort (c.smb, pos, session.PID);
|
||||
pos += 2;
|
||||
setUShort (c.smb, pos, session.UID);
|
||||
pos += 2;
|
||||
setUShort (c.smb, pos, session.MID);
|
||||
}
|
||||
|
||||
/**
|
||||
* MakeTRANS2Hdr
|
||||
*/
|
||||
static void
|
||||
MakeTRANS2Hdr (unsigned char subcommand)
|
||||
{
|
||||
setUChar (c.smb, T2_WORD_CNT, 15);
|
||||
setUShort (c.smb, T2_MAXPRM_CNT, 10);
|
||||
setUShort (c.smb, T2_MAXBUFFER, session.MaxBuffer);
|
||||
setUChar (c.smb, T2_SSETUP_CNT, 1);
|
||||
setUShort (c.smb, T2_SUB_CMD, subcommand);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMBCheck
|
||||
*
|
||||
* Do very basic checking on the return SMB
|
||||
*/
|
||||
static int
|
||||
SMBCheck (unsigned char command, int readlen)
|
||||
{
|
||||
int ret;
|
||||
|
||||
memset (&s, 0, sizeof (s));
|
||||
|
||||
smbcheckbytes = ret = recv (smbsock, (char *) &s, readlen, 0);
|
||||
|
||||
if (ret < 12)
|
||||
return 0;
|
||||
|
||||
/*** Do basic SMB Header checks ***/
|
||||
ret = getUInt (s.smb, 0);
|
||||
if (ret != SMB_PROTO)
|
||||
return BAD_PROTOCOL;
|
||||
|
||||
if (getUChar (s.smb, 4) != command)
|
||||
return SMB_BAD_COMMAND;
|
||||
|
||||
ret = getUInt (s.smb, SMB_OFFSET_NTSTATUS);
|
||||
|
||||
if (ret)
|
||||
return SMB_ERROR;
|
||||
|
||||
return SMB_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* SMB_NegotiateProtocol
|
||||
*
|
||||
* The only protocol we admit to is 'DOS LANMAN 2.1'
|
||||
*/
|
||||
static int
|
||||
SMB_NegotiateProtocol ()
|
||||
{
|
||||
int pos;
|
||||
int bcpos;
|
||||
int ret;
|
||||
char proto[] = "\2LM1.2X002"; /*** Seems to work with Samba and XP Home ***/
|
||||
unsigned short bytecount;
|
||||
|
||||
/*** Clear session variables ***/
|
||||
memset (&session, 0, sizeof (session));
|
||||
session.PID = 0xdead;
|
||||
session.MID = 1;
|
||||
|
||||
MakeSMBHdr (SMB_NEG_PROTOCOL);
|
||||
pos = SMB_HEADER;
|
||||
|
||||
pos++; /*** Add word count ***/
|
||||
bcpos = pos;
|
||||
pos += 2; /*** Byte count - when known ***/
|
||||
|
||||
strcpy (&c.smb[pos], proto);
|
||||
|
||||
pos += strlen (proto) + 1;
|
||||
|
||||
/*** Update byte count ***/
|
||||
setUShort (c.smb, bcpos, (pos - bcpos) - 2);
|
||||
|
||||
/*** Set NBT information ***/
|
||||
c.msg = SESS_MSG;
|
||||
c.length = htons (pos);
|
||||
|
||||
pos += 4;
|
||||
ret = send (smbsock, (char *) &c, pos, 0);
|
||||
|
||||
/*** Check response ***/
|
||||
if (SMBCheck (SMB_NEG_PROTOCOL, sizeof (s)) == SMB_SUCCESS)
|
||||
{
|
||||
pos = SMB_HEADER;
|
||||
/*** Collect information ***/
|
||||
if (getUChar (s.smb, pos) != 13)
|
||||
return SMB_PROTO_FAIL;
|
||||
|
||||
pos++;
|
||||
if (getUShort (s.smb, pos))
|
||||
return SMB_PROTO_FAIL;
|
||||
|
||||
pos += 2;
|
||||
if (getUShort (s.smb, pos) != 3)
|
||||
return SMB_NOT_USER;
|
||||
|
||||
pos += 2;
|
||||
session.MaxBuffer = getUShort (s.smb, pos);
|
||||
pos += 2;
|
||||
if (session.MaxBuffer > 2916)
|
||||
session.MaxBuffer = 2916;
|
||||
session.MaxMpx = getUShort (s.smb, pos);
|
||||
pos += 2;
|
||||
session.MaxVCS = getUShort (s.smb, pos);
|
||||
pos += 2;
|
||||
pos += 2; /*** Raw Mode ***/
|
||||
pos += 4; /*** Session Key ***/
|
||||
pos += 6; /*** Time information ***/
|
||||
if (getUShort (s.smb, pos) != 8)
|
||||
return SMB_BAD_KEYLEN;
|
||||
|
||||
pos += 2;
|
||||
pos += 2; /*** Reserved ***/
|
||||
|
||||
bytecount = getUShort (s.smb, pos);
|
||||
pos += 2;
|
||||
|
||||
/*** Copy challenge key ***/
|
||||
memcpy (&session.challenge, &s.smb[pos], 8);
|
||||
pos += 8;
|
||||
/*** Primary domain ***/
|
||||
strcpy (session.p_domain, &s.smb[pos]);
|
||||
|
||||
return SMB_SUCCESS;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* SMB_SetupAndX
|
||||
*
|
||||
* Setup the SMB session, including authentication with the
|
||||
* magic 'LM Response'
|
||||
*/
|
||||
static int
|
||||
SMB_SetupAndX (char *user, char *password)
|
||||
{
|
||||
int pos;
|
||||
int bcpos;
|
||||
char pwd[24], LMh[24], LMr[24];
|
||||
int i, ret;
|
||||
|
||||
MakeSMBHdr (SMB_SETUP_ANDX);
|
||||
pos = SMB_HEADER;
|
||||
|
||||
setUChar (c.smb, pos, 10);
|
||||
pos++; /*** Word Count ***/
|
||||
setUChar (c.smb, pos, 0xff);
|
||||
pos++; /*** Next AndX ***/
|
||||
pos++; /*** Reserved ***/
|
||||
pos += 2; /*** Next AndX Offset ***/
|
||||
setUShort (c.smb, pos, session.MaxBuffer);
|
||||
pos += 2;
|
||||
setUShort (c.smb, pos, session.MaxMpx);
|
||||
pos += 2;
|
||||
setUShort (c.smb, pos, session.MaxVCS);
|
||||
pos += 2;
|
||||
pos += 4; /*** Session key, unknown at this point ***/
|
||||
setUShort (c.smb, pos, 24);
|
||||
pos += 2; /*** Password length ***/
|
||||
pos += 4; /*** Reserved ***/
|
||||
bcpos = pos;
|
||||
pos += 2; /*** Byte count ***/
|
||||
|
||||
/*** The magic 'LM Response' ***/
|
||||
strcpy (pwd, password);
|
||||
for (i = 0; i < strlen (pwd); i++)
|
||||
pwd[i] = toupper (pwd[i]);
|
||||
|
||||
auth_LMhash (LMh, pwd, strlen (pwd));
|
||||
auth_LMresponse (LMr, LMh, session.challenge);
|
||||
|
||||
/*** Build information ***/
|
||||
memcpy (&c.smb[pos], LMr, 24);
|
||||
pos += 24;
|
||||
|
||||
/*** Account ***/
|
||||
strcpy (pwd, user);
|
||||
for (i = 0; i < strlen (user); i++)
|
||||
pwd[i] = toupper (pwd[i]);
|
||||
memcpy (&c.smb[pos], pwd, strlen (pwd));
|
||||
pos += strlen (pwd) + 1;
|
||||
|
||||
/*** Primary Domain ***/
|
||||
memcpy (&c.smb[pos], &session.p_domain, strlen (session.p_domain));
|
||||
pos += strlen (session.p_domain) + 1;
|
||||
|
||||
/*** Native OS ***/
|
||||
strcpy (pwd, "Unix (libOGC)");
|
||||
memcpy (&c.smb[pos], pwd, strlen (pwd));
|
||||
pos += strlen (pwd) + 1;
|
||||
|
||||
/*** Native LAN Manager ***/
|
||||
strcpy (pwd, "Nintendo GameCube 0.1");
|
||||
memcpy (&c.smb[pos], pwd, strlen (pwd));
|
||||
pos += strlen (pwd) + 1;
|
||||
|
||||
/*** Update byte count ***/
|
||||
setUShort (c.smb, bcpos, (pos - bcpos) - 2);
|
||||
|
||||
c.msg = SESS_MSG;
|
||||
c.length = htons (pos);
|
||||
pos += 4;
|
||||
|
||||
ret = send (smbsock, (char *) &c, pos, 0);
|
||||
|
||||
if (SMBCheck (SMB_SETUP_ANDX, sizeof (s)) == SMB_SUCCESS)
|
||||
{
|
||||
/*** Collect UID ***/
|
||||
session.UID = getUShort (s.smb, SMB_OFFSET_UID);
|
||||
|
||||
return SMB_SUCCESS;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* SMB_TreeAndX
|
||||
*
|
||||
* Finally, connect to the remote share
|
||||
*/
|
||||
static int
|
||||
SMB_TreeAndX (char *server, char *share)
|
||||
{
|
||||
int pos, bcpos, ret;
|
||||
char path[256];
|
||||
|
||||
MakeSMBHdr (SMB_TREEC_ANDX);
|
||||
pos = SMB_HEADER;
|
||||
|
||||
setUChar (c.smb, pos, 4);
|
||||
pos++; /*** Word Count ***/
|
||||
setUChar (c.smb, pos, 0xff);
|
||||
pos++; /*** Next AndX ***/
|
||||
pos++; /*** Reserved ***/
|
||||
pos += 2; /*** Next AndX Offset ***/
|
||||
pos += 2; /*** Flags ***/
|
||||
setUShort (c.smb, pos, 1);
|
||||
pos += 2; /*** Password Length ***/
|
||||
bcpos = pos;
|
||||
pos += 2;
|
||||
pos++; /*** NULL Password ***/
|
||||
|
||||
/*** Build server share path ***/
|
||||
strcpy (path, "\\\\");
|
||||
strcat (path, server);
|
||||
strcat (path, "\\");
|
||||
strcat (path, share);
|
||||
for (ret = 0; ret < strlen (path); ret++)
|
||||
path[ret] = toupper (path[ret]);
|
||||
|
||||
memcpy (&c.smb[pos], path, strlen (path));
|
||||
pos += strlen (path) + 1;
|
||||
|
||||
/*** Service ***/
|
||||
strcpy (path, "?????");
|
||||
memcpy (&c.smb[pos], path, strlen (path));
|
||||
pos += strlen (path) + 1;
|
||||
|
||||
/*** Update byte count ***/
|
||||
setUShort (c.smb, bcpos, (pos - bcpos) - 2);
|
||||
|
||||
c.msg = SESS_MSG;
|
||||
c.length = htons (pos);
|
||||
pos += 4;
|
||||
|
||||
ret = send (smbsock, (char *) &c, pos, 0);
|
||||
|
||||
if (SMBCheck (SMB_TREEC_ANDX, sizeof (s)) == SMB_SUCCESS)
|
||||
{
|
||||
/*** Collect Tree ID ***/
|
||||
session.TID = getUShort (s.smb, SMB_OFFSET_TID);
|
||||
return SMB_SUCCESS;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* SMB_FindFirst
|
||||
*
|
||||
* Uses TRANS2 to support long filenames
|
||||
*/
|
||||
int
|
||||
SMB_FindFirst (char *filename, unsigned short flags, SMBDIRENTRY * sdir)
|
||||
{
|
||||
int pos;
|
||||
int ret;
|
||||
int bpos;
|
||||
|
||||
MakeSMBHdr (SMB_TRANS2);
|
||||
MakeTRANS2Hdr (SMB_FIND_FIRST2);
|
||||
pos = T2_BYTE_CNT + 2;
|
||||
bpos = pos;
|
||||
pos += 3; /*** Padding ***/
|
||||
|
||||
setUShort (c.smb, pos, flags);
|
||||
pos += 2; /*** Flags ***/
|
||||
setUShort (c.smb, pos, 1);
|
||||
pos += 2; /*** Count ***/
|
||||
setUShort (c.smb, pos, 6);
|
||||
pos += 2; /*** Internal Flags ***/
|
||||
setUShort (c.smb, pos, 260);
|
||||
pos += 2; /*** Level of Interest ***/
|
||||
pos += 4; /*** Storage Type == 0 ***/
|
||||
memcpy (&c.smb[pos], filename, strlen (filename));
|
||||
pos += strlen (filename) + 1; /*** Include padding ***/
|
||||
|
||||
/*** Update counts ***/
|
||||
setUShort (c.smb, T2_PRM_CNT, 13 + strlen (filename));
|
||||
setUShort (c.smb, T2_SPRM_CNT, 13 + strlen (filename));
|
||||
setUShort (c.smb, T2_SPRM_OFS, 68);
|
||||
setUShort (c.smb, T2_SDATA_OFS, 81 + strlen (filename));
|
||||
setUShort (c.smb, T2_BYTE_CNT, pos - bpos);
|
||||
|
||||
c.msg = SESS_MSG;
|
||||
c.length = htons (pos);
|
||||
|
||||
pos += 4;
|
||||
|
||||
ret = send (smbsock, (char *) &c, pos, 0);
|
||||
session.sid = 0;
|
||||
session.count = 0;
|
||||
session.eos = 1;
|
||||
|
||||
if (SMBCheck (SMB_TRANS2, sizeof (s)) == SMB_SUCCESS)
|
||||
{
|
||||
/*** Get parameter offset ***/
|
||||
pos = getUShort (s.smb, SMB_HEADER + 9);
|
||||
session.sid = getUShort (s.smb, pos);
|
||||
pos += 2;
|
||||
session.count = getUShort (s.smb, pos);
|
||||
pos += 2;
|
||||
session.eos = getUShort (s.smb, pos);
|
||||
pos += 2;
|
||||
pos += 46;
|
||||
|
||||
if (session.count)
|
||||
{
|
||||
sdir->size_low = getUInt (s.smb, pos);
|
||||
pos += 4;
|
||||
sdir->size_high = getUInt (s.smb, pos);
|
||||
pos += 4;
|
||||
pos += 8;
|
||||
sdir->attributes = getUInt (s.smb, pos);
|
||||
pos += 38;
|
||||
strcpy (sdir->name, &s.smb[pos]);
|
||||
|
||||
return SMB_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* SMB_FindNext
|
||||
*/
|
||||
int
|
||||
SMB_FindNext (SMBDIRENTRY * sdir)
|
||||
{
|
||||
int pos;
|
||||
int ret;
|
||||
int bpos;
|
||||
|
||||
if (session.eos)
|
||||
return 0;
|
||||
|
||||
if (session.sid == 0)
|
||||
return 0;
|
||||
|
||||
MakeSMBHdr (SMB_TRANS2);
|
||||
MakeTRANS2Hdr (SMB_FIND_NEXT2);
|
||||
pos = T2_BYTE_CNT + 2;
|
||||
bpos = pos;
|
||||
pos += 3; /*** Padding ***/
|
||||
|
||||
setUShort (c.smb, pos, session.sid);
|
||||
pos += 2; /*** Search ID ***/
|
||||
setUShort (c.smb, pos, 1);
|
||||
pos += 2; /*** Count ***/
|
||||
setUShort (c.smb, pos, 260);
|
||||
pos += 2; /*** Level of Interest ***/
|
||||
pos += 4; /*** Storage Type == 0 ***/
|
||||
setUShort (c.smb, pos, 12);
|
||||
pos += 2; /*** Search flags ***/
|
||||
pos++;
|
||||
|
||||
/*** Update counts ***/
|
||||
setUShort (c.smb, T2_PRM_CNT, 13);
|
||||
setUShort (c.smb, T2_SPRM_CNT, 13);
|
||||
setUShort (c.smb, T2_SPRM_OFS, 68);
|
||||
setUShort (c.smb, T2_SDATA_OFS, 81);
|
||||
setUShort (c.smb, T2_BYTE_CNT, pos - bpos);
|
||||
|
||||
c.msg = SESS_MSG;
|
||||
c.length = htons (pos);
|
||||
|
||||
pos += 4;
|
||||
|
||||
ret = send (smbsock, (char *) &c, pos, 0);
|
||||
|
||||
if (SMBCheck (SMB_TRANS2, sizeof (s)) == SMB_SUCCESS)
|
||||
{
|
||||
/*** Get parameter offset ***/
|
||||
pos = getUShort (s.smb, SMB_HEADER + 9);
|
||||
session.count = getUShort (s.smb, pos);
|
||||
pos += 2;
|
||||
session.eos = getUShort (s.smb, pos);
|
||||
pos += 2;
|
||||
pos += 44;
|
||||
|
||||
if (session.count)
|
||||
{
|
||||
sdir->size_low = getUInt (s.smb, pos);
|
||||
pos += 4;
|
||||
sdir->size_high = getUInt (s.smb, pos);
|
||||
pos += 4;
|
||||
pos += 8;
|
||||
sdir->attributes = getUInt (s.smb, pos);
|
||||
pos += 38;
|
||||
strcpy (sdir->name, &s.smb[pos]);
|
||||
|
||||
return SMB_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* SMB_FindClose
|
||||
*/
|
||||
int
|
||||
SMB_FindClose ()
|
||||
{
|
||||
int pos = SMB_HEADER;
|
||||
int ret;
|
||||
|
||||
if (session.sid == 0)
|
||||
return 0;
|
||||
|
||||
MakeSMBHdr (SMB_FIND_CLOSE2);
|
||||
|
||||
setUChar (c.smb, pos, 1);
|
||||
pos++; /*** Word Count ***/
|
||||
setUShort (c.smb, pos, session.sid);
|
||||
pos += 2;
|
||||
pos += 2; /*** Byte Count ***/
|
||||
|
||||
c.msg = SESS_MSG;
|
||||
c.length = htons (pos);
|
||||
pos += 4;
|
||||
ret = send (smbsock, (char *) &c, pos, 0);
|
||||
|
||||
return SMBCheck (SMB_FIND_CLOSE2, sizeof (s));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* SMB_Open
|
||||
*/
|
||||
SMBFILE
|
||||
SMB_Open (char *filename, unsigned short access, unsigned short creation)
|
||||
{
|
||||
int pos = SMB_HEADER;
|
||||
int bpos, ret;
|
||||
char realfile[256];
|
||||
unsigned short fid;
|
||||
|
||||
MakeSMBHdr (SMB_OPEN_ANDX);
|
||||
|
||||
setUChar (c.smb, pos, 15);
|
||||
pos++; /*** Word Count ***/
|
||||
setUChar (c.smb, pos, 0xff);
|
||||
pos++; /*** Next AndX ***/
|
||||
pos += 3; /*** Next AndX Offset ***/
|
||||
|
||||
pos += 2; /*** Flags ***/
|
||||
setUShort (c.smb, pos, access);
|
||||
pos += 2; /*** Access mode ***/
|
||||
setUShort (c.smb, pos, 0x6);
|
||||
pos += 2; /*** Type of file ***/
|
||||
pos += 2; /*** Attributes ***/
|
||||
pos += 4; /*** File time - don't care - let server decide ***/
|
||||
setUShort (c.smb, pos, creation);
|
||||
pos += 2; /*** Creation flags ***/
|
||||
pos += 4; /*** Allocation size ***/
|
||||
pos += 8; /*** Reserved ***/
|
||||
pos += 2; /*** Byte Count ***/
|
||||
bpos = pos;
|
||||
|
||||
if (filename[0] != '\\')
|
||||
{
|
||||
strcpy (realfile, "\\");
|
||||
strcat (realfile, filename);
|
||||
}
|
||||
else
|
||||
strcpy (realfile, filename);
|
||||
|
||||
memcpy (&c.smb[pos], realfile, strlen (realfile));
|
||||
pos += strlen (realfile) + 1;
|
||||
|
||||
setUShort (c.smb, bpos - 2, (pos - bpos));
|
||||
|
||||
c.msg = SESS_MSG;
|
||||
c.length = htons (pos);
|
||||
|
||||
pos += 4;
|
||||
ret = send (smbsock, (char *) &c, pos, 0);
|
||||
|
||||
if (SMBCheck (SMB_OPEN_ANDX, sizeof (s)) == SMB_SUCCESS)
|
||||
{
|
||||
/*** Check file handle ***/
|
||||
fid = getUShort (s.smb, SMB_HEADER + 5);
|
||||
|
||||
if (fid)
|
||||
return fid;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* SMB_Close
|
||||
*/
|
||||
void
|
||||
SMB_Close (SMBFILE sfid)
|
||||
{
|
||||
int pos, ret;
|
||||
|
||||
MakeSMBHdr (SMB_CLOSE);
|
||||
pos = SMB_HEADER;
|
||||
|
||||
setUChar (c.smb, pos, 3);
|
||||
pos++; /** Word Count **/
|
||||
setUShort (c.smb, pos, sfid);
|
||||
pos += 2;
|
||||
setUInt (c.smb, pos, 0xffffffff);
|
||||
pos += 4; /*** Last Write ***/
|
||||
pos += 2; /*** Byte Count ***/
|
||||
|
||||
c.msg = SESS_MSG;
|
||||
c.length = htons (pos);
|
||||
pos += 4;
|
||||
ret = send (smbsock, (char *) &c, pos, 0);
|
||||
|
||||
SMBCheck (SMB_CLOSE, sizeof (s));
|
||||
}
|
||||
|
||||
/**
|
||||
* SMB_Read
|
||||
*/
|
||||
int
|
||||
SMB_Read (char *buffer, int size, int offset, SMBFILE sfile)
|
||||
{
|
||||
int pos, ret, ofs;
|
||||
unsigned short length = 0;
|
||||
|
||||
MakeSMBHdr (SMB_READ_ANDX);
|
||||
pos = SMB_HEADER;
|
||||
|
||||
/*** Don't let the size exceed! ***/
|
||||
if (size > 62 * 1024)
|
||||
return 0;
|
||||
|
||||
setUChar (c.smb, pos, 10);
|
||||
pos++; /*** Word count ***/
|
||||
setUChar (c.smb, pos, 0xff);
|
||||
pos++;
|
||||
pos += 3; /*** Reserved, Next AndX Offset ***/
|
||||
setUShort (c.smb, pos, sfile);
|
||||
pos += 2; /*** FID ***/
|
||||
setUInt (c.smb, pos, offset);
|
||||
pos += 4; /*** Offset ***/
|
||||
|
||||
setUShort (c.smb, pos, size & 0xffff);
|
||||
pos += 2;
|
||||
setUShort (c.smb, pos, size & 0xffff);
|
||||
pos += 2;
|
||||
setUInt (c.smb, pos, 0);
|
||||
pos += 4;
|
||||
pos += 2; /*** Remaining ***/
|
||||
pos += 2; /*** Byte count ***/
|
||||
|
||||
c.msg = SESS_MSG;
|
||||
c.length = htons (pos);
|
||||
|
||||
pos += 4;
|
||||
ret = send (smbsock, (char *) &c, pos, 0);
|
||||
|
||||
/*** SMBCheck should now only read up to the end of a standard header ***/
|
||||
if (SMBCheck (SMB_READ_ANDX, SMB_HEADER + 27 + 4) == SMB_SUCCESS)
|
||||
{
|
||||
/*** Retrieve data length for this packet ***/
|
||||
length = getUShort (s.smb, SMB_HEADER + 11);
|
||||
/*** Retrieve offset to data ***/
|
||||
ofs = getUShort (s.smb, SMB_HEADER + 13);
|
||||
|
||||
/*** Default offset, with no padding is 59, so grab any outstanding padding ***/
|
||||
if (ofs > 59)
|
||||
{
|
||||
char pad[1024];
|
||||
ret = recv (smbsock, pad, ofs - 59, 0);
|
||||
}
|
||||
|
||||
/*** Finally, go grab the data ***/
|
||||
ofs = 0;
|
||||
|
||||
if (length)
|
||||
{
|
||||
while (((ret = recv (smbsock, buffer + ofs, length, 0)) > 0))
|
||||
{
|
||||
ofs += ret;
|
||||
if (ofs == length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ofs;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* SMB_Write
|
||||
*/
|
||||
int
|
||||
SMB_Write (char *buffer, int size, int offset, SMBFILE sfile)
|
||||
{
|
||||
int pos, ret;
|
||||
int blocks64;
|
||||
|
||||
MakeSMBHdr (SMB_WRITE_ANDX);
|
||||
pos = SMB_HEADER;
|
||||
|
||||
setUChar (c.smb, pos, 12);
|
||||
pos++; /*** Word Count ***/
|
||||
setUChar (c.smb, pos, 0xff);
|
||||
pos += 2; /*** Next AndX ***/
|
||||
pos += 2; /*** Next AndX Offset ***/
|
||||
|
||||
setUShort (c.smb, pos, sfile);
|
||||
pos += 2;
|
||||
setUInt (c.smb, pos, offset);
|
||||
pos += 4;
|
||||
pos += 4; /*** Reserved ***/
|
||||
pos += 2; /*** Write Mode ***/
|
||||
pos += 2; /*** Remaining ***/
|
||||
|
||||
blocks64 = size >> 16;
|
||||
|
||||
setUShort (c.smb, pos, blocks64);
|
||||
pos += 2; /*** Length High ***/
|
||||
setUShort (c.smb, pos, size & 0xffff);
|
||||
pos += 2; /*** Length Low ***/
|
||||
setUShort (c.smb, pos, 59);
|
||||
pos += 2; /*** Data Offset ***/
|
||||
setUShort (c.smb, pos, size & 0xffff);
|
||||
pos += 2; /*** Data Byte Count ***/
|
||||
|
||||
c.msg = SESS_MSG;
|
||||
c.length = htons (pos + size);
|
||||
|
||||
/*** Will this fit in a single send? ***/
|
||||
if (size <= 2916)
|
||||
{
|
||||
memcpy (&c.smb[pos], buffer, size);
|
||||
pos += size;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy (&c.smb[pos], buffer, 2916);
|
||||
pos += 2916;
|
||||
}
|
||||
|
||||
pos += 4;
|
||||
|
||||
/*** Send Header Information ***/
|
||||
ret = send (smbsock, (char *) &c, pos, 0);
|
||||
|
||||
if (size > 2916)
|
||||
{
|
||||
/*** Send the data ***/
|
||||
ret = send (smbsock, buffer + 2916, size - 2916, 0);
|
||||
}
|
||||
|
||||
if (SMBCheck (SMB_WRITE_ANDX, sizeof (s)) == SMB_SUCCESS)
|
||||
{
|
||||
return (int) getUShort (s.smb, SMB_HEADER + 5);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Primary setup, logon and connection all in one :)
|
||||
****************************************************************************/
|
||||
int
|
||||
SMB_Init (char *user, char *password, char *client,
|
||||
char *server, char *share, char *IP)
|
||||
{
|
||||
int ret;
|
||||
int nodelay;
|
||||
|
||||
/*** Create the global socket ***/
|
||||
smbsock = socket (AF_INET, SOCK_STREAM, IPPROTO_IP);
|
||||
|
||||
/*** Switch off Nagle, ON TCP_NODELAY ***/
|
||||
nodelay = 1;
|
||||
ret = setsockopt (smbsock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(char *) &nodelay, sizeof (char));
|
||||
|
||||
/*** Attempt to connect to the server IP ***/
|
||||
memset (&smbs, 0, sizeof (client));
|
||||
smbs.sin_family = AF_INET;
|
||||
smbs.sin_port = htons (445);
|
||||
smbs.sin_addr.s_addr = inet_addr (IP);
|
||||
|
||||
ret = connect (smbsock, (struct sockaddr *) &smbs, sizeof (smbs));
|
||||
|
||||
if (ret)
|
||||
{
|
||||
closesocket (smbsock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (SMB_NegotiateProtocol () == SMB_SUCCESS)
|
||||
{
|
||||
if (SMB_SetupAndX (user, password) == SMB_SUCCESS)
|
||||
{
|
||||
if (SMB_TreeAndX (server, share) == SMB_SUCCESS)
|
||||
return SMB_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* SMB_Destroy
|
||||
*
|
||||
* Probably NEVER called on GameCube, but here for completeness
|
||||
****************************************************************************/
|
||||
void
|
||||
SMB_Destroy ()
|
||||
{
|
||||
if (smbsock)
|
||||
closesocket (smbsock);
|
||||
}
|
219
source/smb/smb.h
Normal file
219
source/smb/smb.h
Normal file
@ -0,0 +1,219 @@
|
||||
/****************************************************************************
|
||||
* TinySMB-GC
|
||||
*
|
||||
* Nintendo Gamecube SaMBa implementation.
|
||||
*
|
||||
* Copyright softdev@tehskeen.com
|
||||
*
|
||||
* Authentication modules, LMhash and DES are
|
||||
*
|
||||
* Copyright Christopher R Hertel.
|
||||
* http://www.ubiqx.org
|
||||
*
|
||||
* You WILL find Ethereal, available from http://www.ethereal.com
|
||||
* invaluable for debugging each new SAMBA implementation.
|
||||
*
|
||||
* Recommended Reading
|
||||
* Implementing CIFS - Christopher R Hertel
|
||||
* SNIA CIFS Documentation - http://www.snia.org
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
****************************************************************************/
|
||||
#ifndef NBTSMB_INC
|
||||
#define NBTSMB_INC
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* NBT/SMB Wrapper
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned char msg; /*** NBT Message ***/
|
||||
unsigned char flags; /*** Not much here really ***/
|
||||
unsigned short length; /*** Length, excluding NBT ***/
|
||||
char smb[2916]; /*** GC Actual is 2920 bytes ***/
|
||||
}
|
||||
NBTSMB;
|
||||
|
||||
/**
|
||||
* Session Information
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned short TID;
|
||||
unsigned short PID;
|
||||
unsigned short UID;
|
||||
unsigned short MID;
|
||||
unsigned short sKey;
|
||||
unsigned short MaxBuffer;
|
||||
unsigned short MaxMpx;
|
||||
unsigned short MaxVCS;
|
||||
unsigned char challenge[10];
|
||||
char p_domain[64];
|
||||
unsigned short sid;
|
||||
unsigned short count;
|
||||
unsigned short eos;
|
||||
}
|
||||
SMBSESSION;
|
||||
|
||||
/*** SMB_FILEENTRY
|
||||
SMB Long Filename Directory Entry
|
||||
***/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int size_low;
|
||||
unsigned int size_high;
|
||||
unsigned int attributes;
|
||||
char name[256];
|
||||
}
|
||||
SMBDIRENTRY;
|
||||
|
||||
/***
|
||||
* SMB File Handle
|
||||
*/
|
||||
typedef unsigned short SMBFILE;
|
||||
|
||||
#define SMB_HEADER 32 /*** SMB Headers are always 32 bytes long ***/
|
||||
#define SMB_PROTO 0x424d53ff
|
||||
|
||||
/**
|
||||
* Field offsets.
|
||||
*/
|
||||
#define SMB_OFFSET_CMD 4
|
||||
#define SMB_OFFSET_NTSTATUS 5
|
||||
#define SMB_OFFSET_ECLASS 5
|
||||
#define SMB_OFFSET_ECODE 7
|
||||
#define SMB_OFFSET_FLAGS 9
|
||||
#define SMB_OFFSET_FLAGS2 10
|
||||
#define SMB_OFFSET_EXTRA 12
|
||||
#define SMB_OFFSET_TID 24
|
||||
#define SMB_OFFSET_PID 26
|
||||
#define SMB_OFFSET_UID 28
|
||||
#define SMB_OFFSET_MID 30
|
||||
|
||||
/**
|
||||
* Message / Commands
|
||||
*/
|
||||
#define SESS_MSG 0x00
|
||||
#define SMB_NEG_PROTOCOL 0x72
|
||||
#define SMB_SETUP_ANDX 0x73
|
||||
#define SMB_TREEC_ANDX 0x75
|
||||
|
||||
/**
|
||||
* SMBTrans2
|
||||
*/
|
||||
#define SMB_TRANS2 0x32
|
||||
|
||||
#define SMB_OPEN2 0
|
||||
#define SMB_FIND_FIRST2 1
|
||||
#define SMB_FIND_NEXT2 2
|
||||
#define SMB_QUERY_FS_INFO 3
|
||||
#define SMB_QUERY_PATH_INFO 5
|
||||
#define SMB_SET_PATH_INFO 6
|
||||
#define SMB_QUERY_FILE_INFO 7
|
||||
#define SMB_SET_FILE_INFO 8
|
||||
#define SMB_CREATE_DIR 13
|
||||
#define SMB_FIND_CLOSE2 0x34
|
||||
|
||||
/**
|
||||
* File I/O
|
||||
*/
|
||||
#define SMB_OPEN_ANDX 0x2d
|
||||
#define SMB_WRITE_ANDX 0x2f
|
||||
#define SMB_READ_ANDX 0x2e
|
||||
#define SMB_CLOSE 4
|
||||
|
||||
/**
|
||||
* SMB File Access Modes
|
||||
*/
|
||||
#define SMB_OPEN_READING 0
|
||||
#define SMB_OPEN_WRITING 1
|
||||
#define SMB_OPEN_READWRITE 2
|
||||
#define SMB_OPEN_COMPATIBLE 0
|
||||
#define SMB_DENY_READWRITE 0x10
|
||||
#define SMB_DENY_WRITE 0x20
|
||||
#define SMB_DENY_READ 0x30
|
||||
#define SMB_DENY_NONE 0x40
|
||||
|
||||
/**
|
||||
* SMB File Open Function
|
||||
*/
|
||||
#define SMB_OF_OPEN 1
|
||||
#define SMB_OF_TRUNCATE 2
|
||||
#define SMB_OF_CREATE 16
|
||||
|
||||
/**
|
||||
* FileSearch
|
||||
*/
|
||||
#define SMB_SRCH_DIRECTORY 16
|
||||
#define SMB_SRCH_READONLY 1
|
||||
#define SMB_SRCH_HIDDEN 2
|
||||
#define SMB_SRCH_SYSTEM 4
|
||||
#define SMB_SRCH_VOLUME 8
|
||||
|
||||
/**
|
||||
* SMB Error codes
|
||||
*/
|
||||
#define SMB_SUCCESS 1
|
||||
#define BAD_PROTOCOL -1
|
||||
#define SMB_ERROR -2
|
||||
#define SMB_BAD_COMMAND -3
|
||||
#define SMB_PROTO_FAIL -4
|
||||
#define SMB_NOT_USER -5
|
||||
#define SMB_BAD_KEYLEN -6
|
||||
|
||||
/**
|
||||
* TRANS2 Offsets
|
||||
*/
|
||||
#define T2_WORD_CNT SMB_HEADER
|
||||
#define T2_PRM_CNT T2_WORD_CNT + 1
|
||||
#define T2_DATA_CNT T2_PRM_CNT + 2
|
||||
#define T2_MAXPRM_CNT T2_DATA_CNT + 2
|
||||
#define T2_MAXBUFFER T2_MAXPRM_CNT + 2
|
||||
#define T2_SETUP_CNT T2_MAXBUFFER + 2
|
||||
#define T2_SPRM_CNT T2_SETUP_CNT + 10
|
||||
#define T2_SPRM_OFS T2_SPRM_CNT + 2
|
||||
#define T2_SDATA_CNT T2_SPRM_OFS + 2
|
||||
#define T2_SDATA_OFS T2_SDATA_CNT + 2
|
||||
#define T2_SSETUP_CNT T2_SDATA_OFS + 2
|
||||
#define T2_SUB_CMD T2_SSETUP_CNT + 2
|
||||
#define T2_BYTE_CNT T2_SUB_CMD + 2
|
||||
|
||||
/**
|
||||
* Prototypes
|
||||
*/
|
||||
|
||||
/*** Session ***/
|
||||
int SMB_Init (char *user, char *password, char *client,
|
||||
char *server, char *share, char *IP);
|
||||
void SMB_Destroy ();
|
||||
|
||||
/*** File Find ***/
|
||||
int SMB_FindFirst (char *filename, unsigned short flags, SMBDIRENTRY * sdir);
|
||||
int SMB_FindNext (SMBDIRENTRY * sdir);
|
||||
int SMB_FindClose ();
|
||||
|
||||
/*** File I/O ***/
|
||||
SMBFILE SMB_Open (char *filename, unsigned short access,
|
||||
unsigned short creation);
|
||||
void SMB_Close (SMBFILE sfid);
|
||||
int SMB_Read (char *buffer, int size, int offset, SMBFILE sfile);
|
||||
int SMB_Write (char *buffer, int size, int offset, SMBFILE sfile);
|
||||
|
||||
#endif
|
205
source/snes9x/3d.h
Normal file
205
source/snes9x/3d.h
Normal file
@ -0,0 +1,205 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _3D_H_
|
||||
#define _3D_H_
|
||||
|
||||
#if defined(USE_OPENGL)
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool8 packed_pixels_extension_present;
|
||||
bool8 draw_cube;
|
||||
uint32 version;
|
||||
// Texture format
|
||||
GLint internal_format;
|
||||
GLint format;
|
||||
GLint type;
|
||||
|
||||
GLint max_texture_size;// 256 or 512
|
||||
GLint texture_size;
|
||||
uint32 num_textures; // 1 if max_texture_size == 256, 2 otherwise
|
||||
GLuint textures [2];
|
||||
} OpenGLData;
|
||||
|
||||
extern OpenGLData OpenGL;
|
||||
|
||||
bool8 S9xOpenGLInit ();
|
||||
bool8 S9xOpenGLInit2 ();
|
||||
void S9xOpenGLPutImage (int width, int height);
|
||||
void S9xOpenGLDeinit ();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_GLIDE
|
||||
#include <glide.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool8 voodoo_present;
|
||||
GrVertex sq[4];
|
||||
GrTexInfo texture;
|
||||
int32 texture_mem_size;
|
||||
int32 texture_mem_start;
|
||||
float x_offset, y_offset;
|
||||
float x_scale, y_scale;
|
||||
float voodoo_width;
|
||||
float voodoo_height;
|
||||
} GlideData;
|
||||
|
||||
extern GlideData Glide;
|
||||
bool8 S9xGlideEnable (bool8 enable);
|
||||
void S9xGlideDeinit ();
|
||||
bool8 S9xGlideInit ();
|
||||
bool8 S9xVoodooInitialise ();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
243
source/snes9x/65c816.h
Normal file
243
source/snes9x/65c816.h
Normal file
@ -0,0 +1,243 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _65c816_h_
|
||||
#define _65c816_h_
|
||||
|
||||
#define AL A.B.l
|
||||
#define AH A.B.h
|
||||
#define XL X.B.l
|
||||
#define XH X.B.h
|
||||
#define YL Y.B.l
|
||||
#define YH Y.B.h
|
||||
#define SL S.B.l
|
||||
#define SH S.B.h
|
||||
#define DL D.B.l
|
||||
#define DH D.B.h
|
||||
#define PL P.B.l
|
||||
#define PH P.B.h
|
||||
|
||||
#define Carry 1
|
||||
#define Zero 2
|
||||
#define IRQ 4
|
||||
#define Decimal 8
|
||||
#define IndexFlag 16
|
||||
#define MemoryFlag 32
|
||||
#define Overflow 64
|
||||
#define Negative 128
|
||||
#define Emulation 256
|
||||
|
||||
#define ClearCarry() (ICPU._Carry = 0)
|
||||
#define SetCarry() (ICPU._Carry = 1)
|
||||
#define SetZero() (ICPU._Zero = 0)
|
||||
#define ClearZero() (ICPU._Zero = 1)
|
||||
#define SetIRQ() (Registers.PL |= IRQ)
|
||||
#define ClearIRQ() (Registers.PL &= ~IRQ)
|
||||
#define SetDecimal() (Registers.PL |= Decimal)
|
||||
#define ClearDecimal() (Registers.PL &= ~Decimal)
|
||||
#define SetIndex() (Registers.PL |= IndexFlag)
|
||||
#define ClearIndex() (Registers.PL &= ~IndexFlag)
|
||||
#define SetMemory() (Registers.PL |= MemoryFlag)
|
||||
#define ClearMemory() (Registers.PL &= ~MemoryFlag)
|
||||
#define SetOverflow() (ICPU._Overflow = 1)
|
||||
#define ClearOverflow() (ICPU._Overflow = 0)
|
||||
#define SetNegative() (ICPU._Negative = 0x80)
|
||||
#define ClearNegative() (ICPU._Negative = 0)
|
||||
|
||||
#define CheckZero() (ICPU._Zero == 0)
|
||||
#define CheckCarry() (ICPU._Carry)
|
||||
#define CheckIRQ() (Registers.PL & IRQ)
|
||||
#define CheckDecimal() (Registers.PL & Decimal)
|
||||
#define CheckIndex() (Registers.PL & IndexFlag)
|
||||
#define CheckMemory() (Registers.PL & MemoryFlag)
|
||||
#define CheckOverflow() (ICPU._Overflow)
|
||||
#define CheckNegative() (ICPU._Negative & 0x80)
|
||||
#define CheckEmulation() (Registers.P.W & Emulation)
|
||||
|
||||
#define ClearFlags(f) (Registers.P.W &= ~(f))
|
||||
#define SetFlags(f) (Registers.P.W |= (f))
|
||||
#define CheckFlag(f) (Registers.PL & (f))
|
||||
|
||||
typedef union
|
||||
{
|
||||
#ifdef LSB_FIRST
|
||||
struct { uint8 l,h; } B;
|
||||
#else
|
||||
struct { uint8 h,l; } B;
|
||||
#endif
|
||||
uint16 W;
|
||||
} pair;
|
||||
|
||||
typedef union {
|
||||
#ifdef LSB_FIRST
|
||||
struct { uint8 xPCl, xPCh, xPB, z; } B;
|
||||
struct { uint16 xPC, d; } W;
|
||||
#else
|
||||
struct { uint8 z, xPB, xPCh, xPCl; } B;
|
||||
struct { uint16 d, xPC; } W;
|
||||
#endif
|
||||
uint32 xPBPC;
|
||||
} PC_t;
|
||||
|
||||
struct SRegisters{
|
||||
uint8 DB;
|
||||
pair P;
|
||||
pair A;
|
||||
pair D;
|
||||
pair S;
|
||||
pair X;
|
||||
pair Y;
|
||||
PC_t PC;
|
||||
};
|
||||
|
||||
#define PBPC PC.xPBPC
|
||||
#define PCw PC.W.xPC
|
||||
#define PCh PC.B.xPCh
|
||||
#define PCl PC.B.xPCl
|
||||
#define PB PC.B.xPB
|
||||
|
||||
EXTERN_C struct SRegisters Registers;
|
||||
|
||||
#endif
|
||||
|
1008
source/snes9x/apu.cpp
Normal file
1008
source/snes9x/apu.cpp
Normal file
File diff suppressed because it is too large
Load Diff
272
source/snes9x/apu.h
Normal file
272
source/snes9x/apu.h
Normal file
@ -0,0 +1,272 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _apu_h_
|
||||
#define _apu_h_
|
||||
|
||||
#include "spc700.h"
|
||||
|
||||
struct SIAPU
|
||||
{
|
||||
uint8 *PC;
|
||||
uint8 *RAM;
|
||||
uint8 *DirectPage;
|
||||
bool8 APUExecuting;
|
||||
uint8 Bit;
|
||||
uint32 Address;
|
||||
uint8 *WaitAddress1;
|
||||
uint8 *WaitAddress2;
|
||||
uint32 WaitCounter;
|
||||
uint8 *ShadowRAM;
|
||||
uint8 *CachedSamples;
|
||||
uint8 _Carry;
|
||||
uint8 _Zero;
|
||||
uint8 _Overflow;
|
||||
uint32 TimerErrorCounter;
|
||||
int32 NextAPUTimerPos;
|
||||
int32 APUTimerCounter;
|
||||
uint32 Scanline;
|
||||
int32 OneCycle;
|
||||
int32 TwoCycles;
|
||||
};
|
||||
|
||||
struct SAPU
|
||||
{
|
||||
int32 Cycles;
|
||||
bool8 ShowROM;
|
||||
uint32 Flags;
|
||||
uint8 KeyedChannels;
|
||||
uint8 OutPorts [4];
|
||||
uint8 DSP [0x80];
|
||||
uint8 ExtraRAM [64];
|
||||
uint16 Timer [3];
|
||||
uint16 TimerTarget [3];
|
||||
bool8 TimerEnabled [3];
|
||||
bool8 TimerValueWritten [3];
|
||||
};
|
||||
|
||||
EXTERN_C struct SAPU APU;
|
||||
EXTERN_C struct SIAPU IAPU;
|
||||
extern int spc_is_dumping;
|
||||
extern int spc_is_dumping_temp;
|
||||
extern uint8 spc_dump_dsp[0x100];
|
||||
STATIC inline void S9xAPUUnpackStatus()
|
||||
{
|
||||
IAPU._Zero = ((APURegisters.P & Zero) == 0) | (APURegisters.P & Negative);
|
||||
IAPU._Carry = (APURegisters.P & Carry);
|
||||
IAPU._Overflow = (APURegisters.P & Overflow) >> 6;
|
||||
}
|
||||
|
||||
STATIC inline void S9xAPUPackStatus()
|
||||
{
|
||||
APURegisters.P &= ~(Zero | Negative | Carry | Overflow);
|
||||
APURegisters.P |= IAPU._Carry | ((IAPU._Zero == 0) << 1) |
|
||||
(IAPU._Zero & 0x80) | (IAPU._Overflow << 6);
|
||||
}
|
||||
|
||||
START_EXTERN_C
|
||||
void S9xResetAPU (void);
|
||||
bool8 S9xInitAPU ();
|
||||
void S9xDeinitAPU ();
|
||||
void S9xDecacheSamples ();
|
||||
int S9xTraceAPU ();
|
||||
int S9xAPUOPrint (char *buffer, uint16 Address);
|
||||
void S9xSetAPUControl (uint8 byte);
|
||||
void S9xSetAPUDSP (uint8 byte);
|
||||
uint8 S9xGetAPUDSP ();
|
||||
void S9xSetAPUTimer (uint16 Address, uint8 byte);
|
||||
void S9xUpdateAPUTimer (void);
|
||||
bool8 S9xInitSound (int quality, bool8 stereo, int buffer_size);
|
||||
void S9xOpenCloseSoundTracingFile (bool8);
|
||||
void S9xPrintAPUState ();
|
||||
extern int32 S9xAPUCycles [256]; // Scaled cycle lengths
|
||||
extern int32 S9xAPUCycleLengths [256]; // Raw data.
|
||||
extern void (*S9xApuOpcodes [256]) (void);
|
||||
END_EXTERN_C
|
||||
|
||||
|
||||
#define APU_VOL_LEFT 0x00
|
||||
#define APU_VOL_RIGHT 0x01
|
||||
#define APU_P_LOW 0x02
|
||||
#define APU_P_HIGH 0x03
|
||||
#define APU_SRCN 0x04
|
||||
#define APU_ADSR1 0x05
|
||||
#define APU_ADSR2 0x06
|
||||
#define APU_GAIN 0x07
|
||||
#define APU_ENVX 0x08
|
||||
#define APU_OUTX 0x09
|
||||
|
||||
#define APU_MVOL_LEFT 0x0c
|
||||
#define APU_MVOL_RIGHT 0x1c
|
||||
#define APU_EVOL_LEFT 0x2c
|
||||
#define APU_EVOL_RIGHT 0x3c
|
||||
#define APU_KON 0x4c
|
||||
#define APU_KOFF 0x5c
|
||||
#define APU_FLG 0x6c
|
||||
#define APU_ENDX 0x7c
|
||||
|
||||
#define APU_EFB 0x0d
|
||||
#define APU_PMON 0x2d
|
||||
#define APU_NON 0x3d
|
||||
#define APU_EON 0x4d
|
||||
#define APU_DIR 0x5d
|
||||
#define APU_ESA 0x6d
|
||||
#define APU_EDL 0x7d
|
||||
|
||||
#define APU_C0 0x0f
|
||||
#define APU_C1 0x1f
|
||||
#define APU_C2 0x2f
|
||||
#define APU_C3 0x3f
|
||||
#define APU_C4 0x4f
|
||||
#define APU_C5 0x5f
|
||||
#define APU_C6 0x6f
|
||||
#define APU_C7 0x7f
|
||||
|
||||
#define APU_SOFT_RESET 0x80
|
||||
#define APU_MUTE 0x40
|
||||
#define APU_ECHO_DISABLED 0x20
|
||||
|
||||
#define FREQUENCY_MASK 0x3fff
|
||||
#endif
|
||||
|
494
source/snes9x/apudebug.cpp
Normal file
494
source/snes9x/apudebug.cpp
Normal file
@ -0,0 +1,494 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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 "snes9x.h"
|
||||
#include "spc700.h"
|
||||
#include "apu.h"
|
||||
#include "soundux.h"
|
||||
#include "cpuexec.h"
|
||||
|
||||
#ifdef SPCTOOL
|
||||
#include "spctool/spc700.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGGER
|
||||
extern int32 env_counter_table[32];
|
||||
|
||||
FILE *apu_trace = NULL;
|
||||
|
||||
static char *S9xMnemonics [256] = {
|
||||
"NOP", "TCALL 0", "SET1 $%02X.0", "BBS $%02X.0,$%04X",
|
||||
"OR A,$%02X", "OR A,!$%04X", "OR A,(X)", "OR A,[$%02X+X]",
|
||||
"OR A,#$%02X", "OR $%02X,$%02X", "OR1 C,$%04X.%d", "ASL $%02X",
|
||||
"MOV !$%04X,Y", "PUSH PSW", "TSET1 !$%04X", "BRK",
|
||||
"BPL $%04X", "TCALL 1", "CLR1 $%02X.0", "BBC $%02X.0,$%04X",
|
||||
"OR A,$%02X+X", "OR A,!$%04X+X", "OR A,!$%04X+Y", "OR A,[$%02X]+Y",
|
||||
"OR $%02X,#$%02X", "OR (X),(Y)", "DECW $%02X", "ASL $%02X+X",
|
||||
"ASL A", "DEC X", "CMP X,!$%04X", "JMP [!$%04X+X]",
|
||||
"CLRP", "TCALL 2", "SET1 $%02X.1", "BBS $%02X.1,$%04X",
|
||||
"AND A,$%02X", "AND A,!$%04X", "AND A,(X)", "AND A,[$%02X+X]",
|
||||
"AND A,#$%02X", "AND $%02X,$%02X", "OR1 C,/$%04X.%d", "ROL $%02X",
|
||||
"ROL !$%04X", "PUSH A", "CBNE $%02X,$%04X", "BRA $%04X",
|
||||
"BMI $%04X", "TCALL 3", "CLR1 $%02X.1", "BBC $%02X.1,$%04X",
|
||||
"AND A,$%02X+X", "AND A,!$%04X+X", "AND A,!$%04X+Y", "AND A,[$%02X]+Y",
|
||||
"AND $%02X,#$%02X", "AND (X),(Y)", "INCW $%02X", "ROL $%02X+X",
|
||||
"ROL A", "INC X", "CMP X,$%02X", "CALL !$%04X",
|
||||
"SETP", "TCALL 4", "SET1 $%02X.2", "BBS $%02X.2,$%04X",
|
||||
"EOR A,$%02X", "EOR A,!$%04X", "EOR A,(X)", "EOR A,[$%02X+X]",
|
||||
"EOR A,#$%02X", "EOR $%02X,$%02X", "AND1 C,$%04X.%d", "LSR $%02X",
|
||||
"LSR !$%04X", "PUSH X", "TCLR1 !$%04X", "PCALL $%02X",
|
||||
"BVC $%04X", "TCALL 5", "CLR1 $%02X.2", "BBC $%02X.2,$%04X",
|
||||
"EOR A,$%02X+X", "EOR A,!$%04X+X", "EOR A,!$%04X+Y", "EOR A,[$%02X]+Y",
|
||||
"EOR $%02X,#$%02X", "EOR (X),(Y)", "CMPW YA,$%02X", "LSR $%02X+X",
|
||||
"LSR A", "MOV X,A", "CMP Y,!$%04X", "JMP !$%04X",
|
||||
"CLRC", "TCALL 6", "SET1 $%02X.3", "BBS $%02X.3,$%04X",
|
||||
"CMP A,$%02X", "CMP A,!$%04X", "CMP A,(X)", "CMP A,[$%02X+X]",
|
||||
"CMP A,#$%02X", "CMP $%02X,$%02X", "AND1 C,/$%04X.%d", "ROR $%02X",
|
||||
"ROR !$%04X", "PUSH Y", "DBNZ $%02X,$%04X", "RET",
|
||||
"BVS $%04X", "TCALL 7", "CLR1 $%02X.3", "BBC $%02X.3,$%04X",
|
||||
"CMP A,$%02X+X", "CMP A,!$%04X+X", "CMP A,!$%04X+Y", "CMP A,[$%02X]+Y",
|
||||
"CMP $%02X,#$%02X", "CMP (X),(Y)", "ADDW YA,$%02X", "ROR $%02X+X",
|
||||
"ROR A", "MOV A,X", "CMP Y,$%02X", "RET1",
|
||||
"SETC", "TCALL 8", "SET1 $%02X.4", "BBS $%02X.4,$%04X",
|
||||
"ADC A,$%02X", "ADC A,!$%04X", "ADC A,(X)", "ADC A,[$%02X+X]",
|
||||
"ADC A,#$%02X", "ADC $%02X,$%02X", "EOR1 C,$%04X.%d", "DEC $%02X",
|
||||
"DEC !$%04X", "MOV Y,#$%02X", "POP PSW", "MOV $%02X,#$%02X",
|
||||
"BCC $%04X", "TCALL 9", "CLR1 $%02X.4", "BBC $%02X.4,$%04X",
|
||||
"ADC A,$%02X+X", "ADC A,!$%04X+X", "ADC A,!$%04X+Y", "ADC A,[$%02X]+Y",
|
||||
"ADC $%02X,#$%02X", "ADC (X),(Y)", "SUBW YA,$%02X", "DEC $%02X+X",
|
||||
"DEC A", "MOV X,SP", "DIV YA,X", "XCN A",
|
||||
"EI", "TCALL 10", "SET1 $%02X.5", "BBS $%02X.5,$%04X",
|
||||
"SBC A,$%02X", "SBC A,!$%04X", "SBC A,(X)", "SBC A,[$%02X+X]",
|
||||
"SBC A,#$%02X", "SBC $%02X,$%02X", "MOV1 C,$%04X.%d", "INC $%02X",
|
||||
"INC !$%04X", "CMP Y,#$%02X", "POP A", "MOV (X)+,A",
|
||||
"BCS $%04X", "TCALL 11", "CLR1 $%02X.5", "BBC $%02X.5,$%04X",
|
||||
"SBC A,$%02X+X", "SBC A,!$%04X+X", "SBC A,!$%04X+Y", "SBC A,[$%02X]+Y",
|
||||
"SBC $%02X,#$%02X", "SBC (X),(Y)", "MOVW YA,$%02X", "INC $%02X+X",
|
||||
"INC A", "MOV SP,X", "DAS A", "MOV A,(X)+",
|
||||
"DI", "TCALL 12", "SET1 $%02X.6", "BBS $%02X.6,$%04X",
|
||||
"MOV $%02X,A", "MOV !$%04X,A", "MOV (X),A", "MOV [$%02X+X],A",
|
||||
"CMP X,#$%02X", "MOV !$%04X,X", "MOV1 $%04X.%d,C", "MOV $%02X,Y",
|
||||
"ASL !$%04X", "MOV X,#$%02X", "POP X", "MUL YA",
|
||||
"BNE $%04X", "TCALL 13", "CLR1 $%02X.6", "BBC $%02X.6,$%04X",
|
||||
"MOV $%02X+X,A", "MOV !$%04X+X,A", "MOV !$%04X+Y,A", "MOV [$%02X]+Y,A",
|
||||
"MOV $%02X,X", "MOV $%02X+Y,X", "MOVW $%02X,YA", "MOV $%02X+X,Y",
|
||||
"DEC Y", "MOV A,Y", "CBNE $%02X+X,$%04X", "DAA A",
|
||||
"CLRV", "TCALL 14", "SET1 $%02X.7", "BBS $%02X.7,$%04X",
|
||||
"MOV A,$%02X", "MOV A,!$%04X", "MOV A,(X)", "MOV A,[$%02X+X]",
|
||||
"MOV A,#$%02X", "MOV X,!$%04X", "NOT1 $%04X.%d", "MOV Y,$%02X",
|
||||
"MOV Y,!$%04X", "NOTC", "POP Y", "SLEEP",
|
||||
"BEQ $%04X", "TCALL 15", "CLR1 $%02X.7", "BBC $%02X.7,$%04X",
|
||||
"MOV A,$%02X+X", "MOV A,!$%04X+X", "MOV A,!$%04X+Y", "MOV A,[$%02X]+Y",
|
||||
"MOV X,$%02X", "MOV X,$%02X+Y", "MOV $%02X,$%02X", "MOV Y,$%02X+X",
|
||||
"INC Y", "MOV Y,A", "DBNZ Y,$%04X", "STOP"
|
||||
};
|
||||
|
||||
#undef ABS
|
||||
|
||||
#define DP 0
|
||||
#define ABS 1
|
||||
#define IM 2
|
||||
#define DP2DP 3
|
||||
#define DPIM 4
|
||||
#define DPREL 5
|
||||
#define ABSBIT 6
|
||||
#define REL 7
|
||||
|
||||
static uint8 Modes [256] = {
|
||||
IM, IM, DP, DPREL,
|
||||
DP, ABS, IM, DP,
|
||||
DP, DP2DP, ABSBIT, DP,
|
||||
ABS, IM, ABS, IM,
|
||||
REL, IM, DP, DPREL,
|
||||
DP, ABS, ABS, DP,
|
||||
DPIM, IM, DP, DP,
|
||||
IM, IM, ABS, ABS,
|
||||
IM, IM, DP, DPREL,
|
||||
DP, ABS, IM, DP,
|
||||
DP, DP2DP, ABSBIT, DP,
|
||||
ABS, IM, DPREL, REL,
|
||||
REL, IM, DP, DPREL,
|
||||
DP, ABS, ABS, DP,
|
||||
DPIM, IM, DP, DP,
|
||||
IM, IM, DP, ABS,
|
||||
IM, IM, DP, DPREL,
|
||||
DP, ABS, IM, DP,
|
||||
DP, DP2DP, ABSBIT, DP,
|
||||
ABS, IM, ABS, DP,
|
||||
REL, IM, DP, DPREL,
|
||||
DP, ABS, ABS, DP,
|
||||
DPIM, IM, DP, DP,
|
||||
IM, IM, ABS, ABS,
|
||||
IM, IM, DP, DPREL,
|
||||
DP, ABS, IM, DP,
|
||||
DP, DP2DP, ABSBIT, DP,
|
||||
ABS, IM, DPREL, IM,
|
||||
REL, IM, DP, DPREL,
|
||||
DP, ABS, ABS, DP,
|
||||
DPIM, IM, DP, DP,
|
||||
IM, IM, DP, IM,
|
||||
IM, IM, DP, DPREL,
|
||||
DP, ABS, IM, DP,
|
||||
DP, DP2DP, ABSBIT, DP,
|
||||
ABS, DP, IM, DPIM,
|
||||
REL, IM, DP, DPREL,
|
||||
DP, ABS, ABS, DP,
|
||||
DPIM, IM, DP, DP,
|
||||
IM, IM, IM, IM,
|
||||
IM, IM, DP, DPREL,
|
||||
DP, ABS, IM, DP,
|
||||
DP, DP2DP, ABSBIT, DP,
|
||||
ABS, DP, IM, IM,
|
||||
REL, IM, DP, DPREL,
|
||||
DP, ABS, ABS, DP,
|
||||
DPIM, IM, DP, DP,
|
||||
IM, IM, IM, IM,
|
||||
IM, IM, DP, DPREL,
|
||||
DP, ABS, IM, DP,
|
||||
DP, ABS, ABSBIT, DP,
|
||||
ABS, DP, IM, IM,
|
||||
REL, IM, DP, DPREL,
|
||||
DP, ABS, ABS, DP,
|
||||
DP, DP, DP, DP,
|
||||
IM, IM, DPREL, IM,
|
||||
IM, IM, DP, DPREL,
|
||||
DP, ABS, IM, DP,
|
||||
DP, ABS, ABSBIT, DP,
|
||||
ABS, IM, IM, IM,
|
||||
REL, IM, DP, DPREL,
|
||||
DP, ABS, ABS, DP,
|
||||
DP, DP, DP2DP, DP,
|
||||
IM, IM, REL, IM
|
||||
};
|
||||
|
||||
static uint8 ModesToBytes [] = {
|
||||
2, 3, 1, 3, 3, 3, 3, 2
|
||||
};
|
||||
|
||||
static FILE *SoundTracing = NULL;
|
||||
|
||||
void S9xOpenCloseSoundTracingFile (bool8 open)
|
||||
{
|
||||
if (open && !SoundTracing)
|
||||
{
|
||||
SoundTracing = fopen ("sound_trace.log", "w");
|
||||
}
|
||||
else
|
||||
if (!open && SoundTracing)
|
||||
{
|
||||
fclose (SoundTracing);
|
||||
SoundTracing = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void S9xTraceSoundDSP (const char *s, int i1 = 0, int i2 = 0, int i3 = 0,
|
||||
int i4 = 0, int i5 = 0, int i6 = 0, int i7 = 0)
|
||||
{
|
||||
fprintf (SoundTracing, s, i1, i2, i3, i4, i5, i6, i7);
|
||||
}
|
||||
|
||||
int S9xTraceAPU ()
|
||||
{
|
||||
char buffer [200];
|
||||
|
||||
uint8 b = S9xAPUOPrint (buffer, IAPU.PC - IAPU.RAM);
|
||||
if (apu_trace == NULL)
|
||||
apu_trace = fopen ("apu_trace.log", "wb");
|
||||
|
||||
fprintf (apu_trace, "%s\n", buffer);
|
||||
return (b);
|
||||
}
|
||||
|
||||
int S9xAPUOPrint (char *buffer, uint16 Address)
|
||||
{
|
||||
char mnem [100];
|
||||
uint8 *p = IAPU.RAM + Address;
|
||||
int mode = Modes [*p];
|
||||
int bytes = ModesToBytes [mode];
|
||||
|
||||
switch (bytes)
|
||||
{
|
||||
case 1:
|
||||
sprintf (buffer, "%04X %02X ", p - IAPU.RAM, *p);
|
||||
break;
|
||||
case 2:
|
||||
sprintf (buffer, "%04X %02X %02X ", p - IAPU.RAM, *p,
|
||||
*(p + 1));
|
||||
break;
|
||||
case 3:
|
||||
sprintf (buffer, "%04X %02X %02X %02X ", p - IAPU.RAM, *p,
|
||||
*(p + 1), *(p + 2));
|
||||
break;
|
||||
}
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case DP:
|
||||
sprintf (mnem, S9xMnemonics [*p], *(p + 1));
|
||||
break;
|
||||
case ABS:
|
||||
sprintf (mnem, S9xMnemonics [*p], *(p + 1) + (*(p + 2) << 8));
|
||||
break;
|
||||
case IM:
|
||||
sprintf (mnem, S9xMnemonics [*p]);
|
||||
break;
|
||||
case DP2DP:
|
||||
sprintf (mnem, S9xMnemonics [*p], *(p + 2), *(p + 1));;
|
||||
break;
|
||||
case DPIM:
|
||||
sprintf (mnem, S9xMnemonics [*p], *(p + 2), *(p + 1));;
|
||||
break;
|
||||
case DPREL:
|
||||
sprintf (mnem, S9xMnemonics [*p], *(p + 1),
|
||||
(int) (p + 3 - IAPU.RAM) + (signed char) *(p + 2));
|
||||
break;
|
||||
case ABSBIT:
|
||||
sprintf (mnem, S9xMnemonics [*p], (*(p + 1) + (*(p + 2) << 8)) & 0x1fff,
|
||||
*(p + 2) >> 5);
|
||||
break;
|
||||
case REL:
|
||||
sprintf (mnem, S9xMnemonics [*p],
|
||||
(int) (p + 2 - IAPU.RAM) + (signed char) *(p + 1));
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf (buffer, "%s %-20s A:%02X X:%02X Y:%02X S:%02X P:%c%c%c%c%c%c%c%c %03ld %04ld %04d",
|
||||
buffer, mnem,
|
||||
APURegisters.YA.B.A, APURegisters.X, APURegisters.YA.B.Y,
|
||||
APURegisters.S,
|
||||
APUCheckNegative () ? 'N' : 'n',
|
||||
APUCheckOverflow () ? 'V' : 'v',
|
||||
APUCheckDirectPage () ? 'P' : 'p',
|
||||
APUCheckBreak () ? 'B' : 'b',
|
||||
APUCheckHalfCarry () ? 'H' : 'h',
|
||||
APUCheckInterrupt () ? 'I' : 'i',
|
||||
APUCheckZero () ? 'Z' : 'z',
|
||||
APUCheckCarry () ? 'C' : 'c',
|
||||
CPU.V_Counter,
|
||||
CPU.Cycles,
|
||||
APU.Cycles);
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
const char *as_binary (uint8 data)
|
||||
{
|
||||
static char buf [9];
|
||||
|
||||
for (int i = 7; i >= 0; i--)
|
||||
buf [7 - i] = ((data & (1 << i)) != 0) + '0';
|
||||
|
||||
buf [8] = 0;
|
||||
return (buf);
|
||||
}
|
||||
|
||||
void S9xPrintAPUState ()
|
||||
{
|
||||
printf ("Master volume left: %d, right: %d\n",
|
||||
SoundData.master_volume_left, SoundData.master_volume_right);
|
||||
printf ("Echo: %s %s, Delay: %d Feedback: %d Left: %d Right: %d\n",
|
||||
SoundData.echo_write_enabled ? "on" : "off",
|
||||
as_binary (SoundData.echo_enable),
|
||||
SoundData.echo_buffer_size >> 9,
|
||||
SoundData.echo_feedback, SoundData.echo_volume_left,
|
||||
SoundData.echo_volume_right);
|
||||
|
||||
printf ("Noise: %s, Frequency: %d, Pitch mod: %s\n", as_binary (APU.DSP [APU_NON]),
|
||||
env_counter_table [APU.DSP [APU_FLG] & 0x1f],
|
||||
as_binary (SoundData.pitch_mod));
|
||||
extern int FilterTaps [8];
|
||||
|
||||
printf ("Filter: ");
|
||||
for (int i = 0; i < 8; i++)
|
||||
printf ("%03d, ", FilterTaps [i]);
|
||||
printf ("\n");
|
||||
for (int J = 0; J < 8; J++)
|
||||
{
|
||||
register Channel *ch = &SoundData.channels[J];
|
||||
|
||||
printf ("%d: ", J);
|
||||
if (ch->state == SOUND_SILENT)
|
||||
{
|
||||
printf ("off\n");
|
||||
}
|
||||
else
|
||||
if (!(so.sound_switch & (1 << J)))
|
||||
printf ("muted by user using channel on/off toggle\n");
|
||||
else
|
||||
{
|
||||
int freq = ch->hertz;
|
||||
if (APU.DSP [APU_NON] & (1 << J)) //ch->type == SOUND_NOISE)
|
||||
{
|
||||
freq = env_counter_table [APU.DSP [APU_FLG] & 0x1f];
|
||||
printf ("noise, ");
|
||||
}
|
||||
else
|
||||
printf ("sample %d, ", APU.DSP [APU_SRCN + J * 0x10]);
|
||||
|
||||
printf ("freq: %d", freq);
|
||||
if (J > 0 && (SoundData.pitch_mod & (1 << J)) &&
|
||||
ch->type != SOUND_NOISE)
|
||||
{
|
||||
printf ("(mod), ");
|
||||
}
|
||||
else
|
||||
printf (", ");
|
||||
|
||||
printf ("left: %d, right: %d, ",
|
||||
ch->volume_left, ch->volume_right);
|
||||
|
||||
static char* envelope [] =
|
||||
{
|
||||
"silent", "attack", "decay", "sustain", "release", "gain",
|
||||
"inc_lin", "inc_bent", "dec_lin", "dec_exp"
|
||||
};
|
||||
printf ("%s envx: %d, target: %d, %ld", ch->state > 9 ? "???" : envelope [ch->state],
|
||||
ch->envx, ch->envx_target, ch->erate);
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
303
source/snes9x/apumem.h
Normal file
303
source/snes9x/apumem.h
Normal file
@ -0,0 +1,303 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _apumemory_h_
|
||||
#define _apumemory_h_
|
||||
|
||||
START_EXTERN_C
|
||||
extern uint8 W4;
|
||||
extern uint8 APUROM[64];
|
||||
END_EXTERN_C
|
||||
|
||||
INLINE uint8 S9xAPUGetByteZ (uint8 Address)
|
||||
{
|
||||
if (Address >= 0xf0 && IAPU.DirectPage == IAPU.RAM)
|
||||
{
|
||||
if (Address >= 0xf4 && Address <= 0xf7)
|
||||
{
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitAddress2 = IAPU.WaitAddress1;
|
||||
IAPU.WaitAddress1 = IAPU.PC;
|
||||
#endif
|
||||
return (IAPU.RAM [Address]);
|
||||
}
|
||||
if (Address >= 0xfd)
|
||||
{
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitAddress2 = IAPU.WaitAddress1;
|
||||
IAPU.WaitAddress1 = IAPU.PC;
|
||||
#endif
|
||||
uint8 t = IAPU.RAM [Address];
|
||||
IAPU.RAM [Address] = 0;
|
||||
return (t);
|
||||
}
|
||||
else
|
||||
if (Address == 0xf3)
|
||||
return (S9xGetAPUDSP ());
|
||||
|
||||
return (IAPU.RAM [Address]);
|
||||
}
|
||||
else
|
||||
return (IAPU.DirectPage [Address]);
|
||||
}
|
||||
|
||||
INLINE void S9xAPUSetByteZ (uint8 byte, uint8 Address)
|
||||
{
|
||||
if (Address >= 0xf0 && IAPU.DirectPage == IAPU.RAM)
|
||||
{
|
||||
if (Address == 0xf3)
|
||||
S9xSetAPUDSP (byte);
|
||||
else
|
||||
if (Address >= 0xf4 && Address <= 0xf7)
|
||||
APU.OutPorts [Address - 0xf4] = byte;
|
||||
else
|
||||
if (Address == 0xf1)
|
||||
S9xSetAPUControl (byte);
|
||||
else
|
||||
if (Address < 0xfd)
|
||||
{
|
||||
IAPU.RAM [Address] = byte;
|
||||
if (Address >= 0xfa)
|
||||
{
|
||||
if (byte == 0)
|
||||
APU.TimerTarget [Address - 0xfa] = 0x100;
|
||||
else
|
||||
APU.TimerTarget [Address - 0xfa] = byte;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
IAPU.DirectPage [Address] = byte;
|
||||
}
|
||||
|
||||
INLINE uint8 S9xAPUGetByte (uint32 Address)
|
||||
{
|
||||
Address &= 0xffff;
|
||||
|
||||
if (Address <= 0xff && Address >= 0xf0)
|
||||
{
|
||||
if (Address >= 0xf4 && Address <= 0xf7)
|
||||
{
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitAddress2 = IAPU.WaitAddress1;
|
||||
IAPU.WaitAddress1 = IAPU.PC;
|
||||
#endif
|
||||
return (IAPU.RAM [Address]);
|
||||
}
|
||||
else
|
||||
if (Address == 0xf3)
|
||||
return (S9xGetAPUDSP ());
|
||||
if (Address >= 0xfd)
|
||||
{
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitAddress2 = IAPU.WaitAddress1;
|
||||
IAPU.WaitAddress1 = IAPU.PC;
|
||||
#endif
|
||||
uint8 t = IAPU.RAM [Address];
|
||||
IAPU.RAM [Address] = 0;
|
||||
return (t);
|
||||
}
|
||||
return (IAPU.RAM [Address]);
|
||||
}
|
||||
else
|
||||
return (IAPU.RAM [Address]);
|
||||
}
|
||||
|
||||
INLINE void S9xAPUSetByte (uint8 byte, uint32 Address)
|
||||
{
|
||||
Address &= 0xffff;
|
||||
|
||||
if (Address <= 0xff && Address >= 0xf0)
|
||||
{
|
||||
if (Address == 0xf3)
|
||||
S9xSetAPUDSP (byte);
|
||||
else
|
||||
if (Address >= 0xf4 && Address <= 0xf7)
|
||||
APU.OutPorts [Address - 0xf4] = byte;
|
||||
else
|
||||
if (Address == 0xf1)
|
||||
S9xSetAPUControl (byte);
|
||||
else
|
||||
if (Address < 0xfd)
|
||||
{
|
||||
IAPU.RAM [Address] = byte;
|
||||
if (Address >= 0xfa)
|
||||
{
|
||||
if (byte == 0)
|
||||
APU.TimerTarget [Address - 0xfa] = 0x100;
|
||||
else
|
||||
APU.TimerTarget [Address - 0xfa] = byte;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
if (Address >= 0x2500 && Address <= 0x2504)
|
||||
printf ("%06d %04x <- %02x\n", ICPU.Scanline, Address, byte);
|
||||
if (Address == 0x26c6)
|
||||
{
|
||||
extern FILE *apu_trace;
|
||||
extern FILE *trace;
|
||||
APU.Flags |= TRACE_FLAG;
|
||||
CPU.Flags |= TRACE_FLAG;
|
||||
if (apu_trace == NULL)
|
||||
apu_trace = fopen ("aputrace.log", "wb");
|
||||
if (trace == NULL)
|
||||
trace = fopen ("trace.log", "wb");
|
||||
printf ("TRACING SWITCHED ON\n");
|
||||
}
|
||||
#endif
|
||||
if (Address < 0xffc0)
|
||||
IAPU.RAM [Address] = byte;
|
||||
else
|
||||
{
|
||||
APU.ExtraRAM [Address - 0xffc0] = byte;
|
||||
if (!APU.ShowROM)
|
||||
IAPU.RAM [Address] = byte;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
1176
source/snes9x/bsx.cpp
Normal file
1176
source/snes9x/bsx.cpp
Normal file
File diff suppressed because it is too large
Load Diff
178
source/snes9x/bsx.h
Normal file
178
source/snes9x/bsx.h
Normal file
@ -0,0 +1,178 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _BSX_H_
|
||||
#define _BSX_H_
|
||||
|
||||
struct SBSX
|
||||
{
|
||||
bool8 dirty; // Changed register values
|
||||
bool8 dirty2; // Changed register values
|
||||
bool8 bootup; // Start in bios mapping
|
||||
bool8 flash_enable; // Flash state
|
||||
bool8 write_enable; // ROM write protection
|
||||
bool8 read_enable; // Allow card vendor reading
|
||||
uint32 flash_command; // Flash command
|
||||
uint32 old_write; // Previous flash write address
|
||||
uint32 new_write; // Current flash write address
|
||||
uint8 out_index;
|
||||
uint8 output[32];
|
||||
uint8 PPU[32];
|
||||
uint8 MMC[16];
|
||||
uint8 prevMMC[16];
|
||||
uint8 test2192[32];
|
||||
};
|
||||
|
||||
extern struct SBSX BSX;
|
||||
|
||||
uint8 S9xGetBSX(uint32);
|
||||
void S9xSetBSX(uint8, uint32);
|
||||
uint8 S9xGetBSXPPU(uint16);
|
||||
void S9xSetBSXPPU(uint8, uint16);
|
||||
uint8 * S9xGetPasePointerBSX(uint32);
|
||||
void S9xInitBSX(void);
|
||||
void S9xResetBSX(void);
|
||||
void S9xFixBSXAfterSnapshotLoad(void);
|
||||
|
||||
#endif
|
301
source/snes9x/c4.cpp
Normal file
301
source/snes9x/c4.cpp
Normal file
@ -0,0 +1,301 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#ifdef ZSNES_C4
|
||||
EXTERN_C void C4LoaDMem(char *C4RAM)
|
||||
{
|
||||
memmove(C4RAM+(READ_WORD(C4RAM+0x1f45)&0x1fff),
|
||||
C4GetMemPointer(READ_3WORD(C4RAM+0x1f40)),
|
||||
READ_WORD(C4RAM+0x1f43));
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8 *S9xGetBasePointerC4 (uint16 Address)
|
||||
{
|
||||
if((Address&~MEMMAP_MASK)>=(0x7f40&~MEMMAP_MASK) &&
|
||||
(Address&~MEMMAP_MASK)<=(0x7f5e&~MEMMAP_MASK)){
|
||||
return NULL;
|
||||
}
|
||||
return Memory.C4RAM-0x6000;
|
||||
}
|
||||
|
||||
}//end extern C
|
184
source/snes9x/c4.h
Normal file
184
source/snes9x/c4.h
Normal file
@ -0,0 +1,184 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifndef _C4_H_
|
||||
#define _C4_H_
|
||||
|
||||
#include "port.h"
|
||||
#include "memmap.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern int16 C4WFXVal;
|
||||
extern int16 C4WFYVal;
|
||||
extern int16 C4WFZVal;
|
||||
extern int16 C4WFX2Val;
|
||||
extern int16 C4WFY2Val;
|
||||
extern int16 C4WFDist;
|
||||
extern int16 C4WFScale;
|
||||
|
||||
void C4TransfWireFrame();
|
||||
void C4TransfWireFrame2();
|
||||
void C4CalcWireFrame();
|
||||
|
||||
extern int16 C41FXVal;
|
||||
extern int16 C41FYVal;
|
||||
extern int16 C41FAngleRes;
|
||||
extern int16 C41FDist;
|
||||
extern int16 C41FDistVal;
|
||||
|
||||
void C4Op1F();
|
||||
void C4Op15();
|
||||
void C4Op0D();
|
||||
|
||||
extern int16 C4CosTable[];
|
||||
extern int16 C4SinTable[];
|
||||
|
||||
}
|
||||
|
||||
static inline uint8 *C4GetMemPointer(uint32 Address){
|
||||
return (Memory.ROM + ((Address&0xff0000)>>1) + (Address&0x7fff));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
1070
source/snes9x/c4emu.cpp
Normal file
1070
source/snes9x/c4emu.cpp
Normal file
File diff suppressed because it is too large
Load Diff
328
source/snes9x/clip.cpp
Normal file
328
source/snes9x/clip.cpp
Normal file
@ -0,0 +1,328 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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 "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "ppu.h"
|
||||
|
||||
static uint8 region_map[6][6]={
|
||||
{0, 0x01, 0x03, 0x07, 0x0f, 0x1f },
|
||||
{0, 0, 0x02, 0x06, 0x0e, 0x1e },
|
||||
{0, 0, 0, 0x04, 0x0c, 0x1c },
|
||||
{0, 0, 0, 0, 0x08, 0x18 },
|
||||
{0, 0, 0, 0, 0, 0x10 }
|
||||
};
|
||||
|
||||
static inline uint8 CalcWindowMask(int i, uint8 W1, uint8 W2){
|
||||
if(!PPU.ClipWindow1Enable[i]){
|
||||
if(!PPU.ClipWindow2Enable[i]){
|
||||
return 0;
|
||||
} else {
|
||||
if(!PPU.ClipWindow2Inside[i]) return ~W2;
|
||||
return W2;
|
||||
}
|
||||
} else {
|
||||
if(!PPU.ClipWindow2Enable[i]){
|
||||
if(!PPU.ClipWindow1Inside[i]) return ~W1;
|
||||
return W1;
|
||||
} else {
|
||||
if(!PPU.ClipWindow1Inside[i]) W1=~W1;
|
||||
if(!PPU.ClipWindow2Inside[i]) W2=~W2;
|
||||
switch(PPU.ClipWindowOverlapLogic[i]){
|
||||
case 0: // OR
|
||||
return W1|W2;
|
||||
case 1: // AND
|
||||
return W1&W2;
|
||||
case 2: // XOR
|
||||
return W1^W2;
|
||||
case 3: // XNOR
|
||||
return ~(W1^W2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Never get here
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void StoreWindowRegions(uint8 Mask, struct ClipData *Clip, int n_regions, int16 *windows, uint8 *drawing_modes, bool8 sub, bool8 StoreMode0=FALSE){
|
||||
int ct=0;
|
||||
for(int j=0; j<n_regions; j++){
|
||||
int DrawMode=drawing_modes[j];
|
||||
if(sub) DrawMode|=1;
|
||||
if((Mask&(1<<j))) DrawMode=0;
|
||||
if(!StoreMode0 && !DrawMode) continue;
|
||||
if(ct>0 && Clip->Right[ct-1]==windows[j] && Clip->DrawMode[ct-1]==DrawMode){
|
||||
// This region borders with and has the same drawing mode as the
|
||||
// previous region: merge them.
|
||||
Clip->Right[ct-1]=windows[j+1];
|
||||
} else {
|
||||
// Add a new region to the BG
|
||||
Clip->Left[ct]=windows[j];
|
||||
Clip->Right[ct]=windows[j+1];
|
||||
Clip->DrawMode[ct]=DrawMode;
|
||||
ct++;
|
||||
}
|
||||
}
|
||||
Clip->Count=ct;
|
||||
}
|
||||
|
||||
void ComputeClipWindows () {
|
||||
int16 windows[6]={0,256,256,256,256,256};
|
||||
uint8 drawing_modes[5]={0,0,0,0,0};
|
||||
int n_regions=1;
|
||||
int i, j;
|
||||
|
||||
// Calculate window regions. We have at most 5 regions, because we have 6
|
||||
// control points (screen edges, window 1 left & right, and window 2 left &
|
||||
// right).
|
||||
if(PPU.Window1Left<=PPU.Window1Right){
|
||||
if(PPU.Window1Left>0){
|
||||
windows[2]=256;
|
||||
windows[1]=PPU.Window1Left;
|
||||
n_regions=2;
|
||||
}
|
||||
if(PPU.Window1Right<255){
|
||||
windows[n_regions+1]=256;
|
||||
windows[n_regions]=PPU.Window1Right+1;
|
||||
n_regions++;
|
||||
}
|
||||
}
|
||||
if(PPU.Window2Left<=PPU.Window2Right){
|
||||
for(i=0; i<=n_regions; i++){
|
||||
if(PPU.Window2Left==windows[i]) break;
|
||||
if(PPU.Window2Left<windows[i]){
|
||||
for(j=n_regions; j>=i; j--){
|
||||
windows[j+1]=windows[j];
|
||||
}
|
||||
windows[i]=PPU.Window2Left;
|
||||
n_regions++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(; i<=n_regions; i++){
|
||||
if(PPU.Window2Right+1==windows[i]) break;
|
||||
if(PPU.Window2Right+1<windows[i]){
|
||||
for(j=n_regions; j>=i; j--){
|
||||
windows[j+1]=windows[j];
|
||||
}
|
||||
windows[i]=PPU.Window2Right+1;
|
||||
n_regions++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get a bitmap of which regions correspond to each window.
|
||||
uint8 W1, W2;
|
||||
|
||||
if(PPU.Window1Left<=PPU.Window1Right){
|
||||
for(i=0; windows[i]!=PPU.Window1Left; i++);
|
||||
for(j=i; windows[j]!=PPU.Window1Right+1; j++);
|
||||
W1=region_map[i][j];
|
||||
} else {
|
||||
W1=0;
|
||||
}
|
||||
if(PPU.Window2Left<=PPU.Window2Right){
|
||||
for(i=0; windows[i]!=PPU.Window2Left; i++);
|
||||
for(j=i; windows[j]!=PPU.Window2Right+1; j++);
|
||||
W2=region_map[i][j];
|
||||
} else {
|
||||
W2=0;
|
||||
}
|
||||
|
||||
// Color Window affects the drawing mode for each region. Modes are: 3=Draw
|
||||
// as normal, 2=clip color (math only), 1=no math (draw only), 0=nothing.
|
||||
uint8 CW_color=0, CW_math=0;
|
||||
uint8 CW=CalcWindowMask(5,W1,W2);
|
||||
|
||||
switch(Memory.FillRAM[0x2130]&0xc0){
|
||||
case 0x00:
|
||||
CW_color=0;
|
||||
break;
|
||||
case 0x40:
|
||||
CW_color=~CW;
|
||||
break;
|
||||
case 0x80:
|
||||
CW_color=CW;
|
||||
break;
|
||||
case 0xc0:
|
||||
CW_color=0xff;
|
||||
break;
|
||||
}
|
||||
switch(Memory.FillRAM[0x2130]&0x30){
|
||||
case 0x00:
|
||||
CW_math=0;
|
||||
break;
|
||||
case 0x10:
|
||||
CW_math=~CW;
|
||||
break;
|
||||
case 0x20:
|
||||
CW_math=CW;
|
||||
break;
|
||||
case 0x30:
|
||||
CW_math=0xff;
|
||||
break;
|
||||
}
|
||||
for(i=0; i<n_regions; i++){
|
||||
if(!(CW_color&(1<<i))) drawing_modes[i]|=1;
|
||||
if(!(CW_math&(1<<i))) drawing_modes[i]|=2;
|
||||
}
|
||||
|
||||
// Store backdrop clip window (draw everywhere color window allows)
|
||||
StoreWindowRegions(0, &IPPU.Clip[0][5], n_regions, windows, drawing_modes, FALSE, TRUE);
|
||||
StoreWindowRegions(0, &IPPU.Clip[1][5], n_regions, windows, drawing_modes, TRUE, TRUE);
|
||||
|
||||
// Store per-BG and OBJ clip windows
|
||||
for(j=0; j<5; j++){
|
||||
uint8 W=Settings.DisableGraphicWindows?0:CalcWindowMask(j,W1,W2);
|
||||
for(int sub=0; sub<2; sub++){
|
||||
if(Memory.FillRAM[sub+0x212e]&(1<<j)){
|
||||
StoreWindowRegions(W, &IPPU.Clip[sub][j], n_regions, windows, drawing_modes, sub);
|
||||
} else {
|
||||
StoreWindowRegions(0, &IPPU.Clip[sub][j], n_regions, windows, drawing_modes, sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
2556
source/snes9x/controls.cpp
Normal file
2556
source/snes9x/controls.cpp
Normal file
File diff suppressed because it is too large
Load Diff
421
source/snes9x/controls.h
Normal file
421
source/snes9x/controls.h
Normal file
@ -0,0 +1,421 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifndef FOO_H
|
||||
#define FOO_H
|
||||
|
||||
#include "port.h"
|
||||
|
||||
#define S9xNoMapping 0
|
||||
#define S9xButtonJoypad 1
|
||||
#define S9xButtonMouse 2
|
||||
#define S9xButtonSuperscope 3
|
||||
#define S9xButtonJustifier 4
|
||||
#define S9xButtonCommand 5
|
||||
#define S9xButtonMulti 6
|
||||
#define S9xAxisJoypad 7
|
||||
#define S9xPointer 8
|
||||
|
||||
#define S9xButtonPseudopointer 254
|
||||
#define S9xAxisPseudopointer 253
|
||||
#define S9xAxisPseudobuttons 252
|
||||
|
||||
// These are automatically kicked out to the S9xHandlePortCommand function. If
|
||||
// your port wants to define port-specific commands or whatever, use these
|
||||
// values for the s9xcommand_t type field.
|
||||
#define S9xButtonPort 251
|
||||
#define S9xAxisPort 250
|
||||
#define S9xPointerPort 249
|
||||
|
||||
#define S9xBadMapping 255
|
||||
#define InvalidControlID ((uint32)-1)
|
||||
|
||||
// S9xButtonPseudopointer and S9xAxisPseudopointer will report pointer motion
|
||||
// using IDs PseudoPointerBase through PseudoPointerBase+7.
|
||||
// S9xAxisPseudopointer command types. S9xAxisPseudobuttons will report buttons
|
||||
// with IDs PseudoButtonBase to PseudoButtonBase+255.
|
||||
#define PseudoPointerBase (InvalidControlID-8)
|
||||
#define PseudoButtonBase (PseudoPointerBase-256)
|
||||
|
||||
// Yes, this struct looks huge. But gcc makes it 6 bytes (the minimum), so it's
|
||||
// not that bad.
|
||||
typedef struct {
|
||||
uint8 type;
|
||||
uint8 multi_press:2;
|
||||
uint8 button_norpt:1;
|
||||
|
||||
union {
|
||||
union {
|
||||
struct {
|
||||
uint8 idx:3; // Pad number 0-7
|
||||
uint8 toggle:1; // If set, toggle turbo/sticky for the button
|
||||
uint8 turbo:1; // If set, be a 'turbo' button
|
||||
uint8 sticky:1; // If set, toggle button state (on/turbo or off)
|
||||
// when pressed and do nothing on release
|
||||
uint16 buttons; // Which buttons to actuate.
|
||||
// Use SNES_*_MASK constants from snes9x.h
|
||||
} joypad;
|
||||
|
||||
struct {
|
||||
uint8 idx:1; // Mouse number 0-1
|
||||
uint8 left:1; // buttons
|
||||
uint8 right:1;
|
||||
} mouse;
|
||||
|
||||
struct {
|
||||
uint8 fire:1;
|
||||
uint8 cursor:1;
|
||||
uint8 turbo:1;
|
||||
uint8 pause:1;
|
||||
uint8 aim_offscreen:1; // Pretend we're pointing the gun
|
||||
// offscreen (ignore the pointer)
|
||||
} scope;
|
||||
|
||||
struct {
|
||||
uint8 idx:3; // Pseudo-pointer number 0-7
|
||||
uint8 speed_type:2; // 0=variable, 1=slow, 2=med, 3=fast
|
||||
int8 UD:2; // -1=up, 1=down, 0=no vertical motion
|
||||
int8 LR:2; // -1=left, 1=right, 0=no horizontal motion
|
||||
} pointer;
|
||||
|
||||
struct {
|
||||
uint8 idx:1; // Justifier number 0-1
|
||||
uint8 trigger:1; // buttons
|
||||
uint8 start:1;
|
||||
uint8 aim_offscreen:1; // Pretend we're pointing the gun
|
||||
// offscreen (ignore the pointer)
|
||||
} justifier;
|
||||
|
||||
int32 multi_idx;
|
||||
uint16 command;
|
||||
} button;
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint8 idx:3; // Pad number 0-7
|
||||
uint8 invert:1; // 1 = positive is Left/Up/Y/X/L
|
||||
uint8 axis:3; // 0=Left/Right, 1=Up/Down,
|
||||
// 2=Y/A, 3=X/B, 4=L/R
|
||||
uint8 threshold; // (threshold+1)/256% deflection is a
|
||||
// button press
|
||||
} joypad;
|
||||
|
||||
struct {
|
||||
uint8 idx:3; // Pseudo-pointer number 0-7
|
||||
uint8 speed_type:2; // 0=variable, 1=slow, 2=med, 3=fast
|
||||
uint8 invert:1; // 1 = invert axis, so positive is up/left
|
||||
uint8 HV:1; // 0=horizontal, 1=vertical
|
||||
} pointer;
|
||||
|
||||
struct {
|
||||
uint8 threshold; // (threshold+1)/256% deflection is a
|
||||
// button press
|
||||
uint8 negbutton; // Button ID for negative deflection
|
||||
uint8 posbutton; // Button ID for positive deflection
|
||||
} button;
|
||||
} axis;
|
||||
|
||||
struct {
|
||||
// Which SNES-pointers to control with this pointer
|
||||
uint16 aim_mouse0:1;
|
||||
uint16 aim_mouse1:1;
|
||||
uint16 aim_scope:1;
|
||||
uint16 aim_justifier0:1;
|
||||
uint16 aim_justifier1:1;
|
||||
} pointer;
|
||||
|
||||
uint8 port[4];
|
||||
};
|
||||
} s9xcommand_t;
|
||||
|
||||
|
||||
/* Starting out... */
|
||||
void S9xUnmapAllControls(void);
|
||||
|
||||
/* Setting which controllers are plugged in */
|
||||
enum controllers {
|
||||
CTL_NONE, /* all ids ignored */
|
||||
CTL_JOYPAD, /* use id1 to specify 0-7 */
|
||||
CTL_MOUSE, /* use id1 to specify 0-1 */
|
||||
CTL_SUPERSCOPE,
|
||||
CTL_JUSTIFIER, /* use id1: 0=one justifier, 1=two justifiers */
|
||||
CTL_MP5 /* use id1-id4 to specify pad 0-7 (or -1) */
|
||||
};
|
||||
void S9xSetController(int port, enum controllers controller, int8 id1, int8 id2, int8 id3, int8 id4); /* port=0-1 */
|
||||
void S9xGetController(int port, enum controllers *controller, int8 *id1, int8 *id2, int8 *id3, int8 *id4);
|
||||
void S9xReportControllers(void);
|
||||
|
||||
/* Call this when you're done with S9xSetController, or if you change any of
|
||||
* the controller Settings.*Master flags. Returns true if something was
|
||||
* disabled */
|
||||
bool S9xVerifyControllers(void);
|
||||
|
||||
/*
|
||||
* Functions for translation s9xcommand_t's into strings, and vice versa.
|
||||
* free() the returned string after you're done with it.
|
||||
*/
|
||||
char *S9xGetCommandName(s9xcommand_t command);
|
||||
s9xcommand_t S9xGetCommandT(const char *name);
|
||||
|
||||
/*
|
||||
* Returns an array of strings naming all the snes9x commands. Note that this
|
||||
* is only the strings for S9xButtonCommand! The idea is that this would be
|
||||
* used for a pull-down list in a config GUI. DO NOT free() the returned value.
|
||||
*/
|
||||
const char **S9xGetAllSnes9xCommands(void);
|
||||
|
||||
/*
|
||||
* Generic mapping functions
|
||||
*/
|
||||
s9xcommand_t S9xGetMapping(uint32 id);
|
||||
void S9xUnmapID(uint32 id);
|
||||
|
||||
/*
|
||||
* Button mapping functions. If a button is mapped with poll=TRUE, then
|
||||
* S9xPollButton will be called whenever snes9x feels a need for that mapping.
|
||||
* Otherwise, snes9x will assume you will call S9xReportButton() whenever the
|
||||
* button state changes. S9xMapButton() will fail and return FALSE if
|
||||
* mapping.type isn't a S9xButton* type.
|
||||
*/
|
||||
bool S9xMapButton(uint32 id, s9xcommand_t mapping, bool poll);
|
||||
void S9xReportButton(uint32 id, bool pressed);
|
||||
|
||||
/*
|
||||
* Pointer mapping functions. If a button is mapped with poll=TRUE, then
|
||||
* S9xPollPointer will be called whenever snes9x feels a need for that mapping.
|
||||
* Otherwise, snes9x will assume you will call S9xReportPointer() whenever the
|
||||
* pointer position changes. S9xMapPointer() will fail and return FALSE if
|
||||
* mapping.type isn't S9xPointer.
|
||||
*
|
||||
* Note that position [0,0] is considered the upper-left corner of the
|
||||
* 'screen', and either [255,223] or [255,239] is the lower-right. Note that
|
||||
* the SNES mouse doesn't aim at a particular point, so the SNES's idea of
|
||||
* where the mouse pointer is will probably differ from your OS's idea.
|
||||
*/
|
||||
bool S9xMapPointer(uint32 id, s9xcommand_t mapping, bool poll);
|
||||
void S9xReportPointer(uint32 id, int16 x, int16 y);
|
||||
|
||||
/*
|
||||
* Axis mapping functions. If a button is mapped with poll=TRUE, then
|
||||
* S9xPollAxis will be called whenever snes9x feels a need for that mapping.
|
||||
* Otherwise, snes9x will assume you will call S9xReportAxis() whenever the
|
||||
* axis deflection changes. S9xMapAxis() will fail and return FALSE if
|
||||
* mapping.type isn't a S9xAxis* type.
|
||||
*
|
||||
* Note that value is linear -32767 through 32767 with 0 being no
|
||||
* deflection. If your axis reports differently you should transform the
|
||||
* value before passing it to S9xReportAxis().
|
||||
*/
|
||||
bool S9xMapAxis(uint32 id, s9xcommand_t mapping, bool poll);
|
||||
void S9xReportAxis(uint32 id, int16 value);
|
||||
|
||||
/*
|
||||
* Do whatever the s9xcommand_t says to do. If cmd.type is a button type, data1
|
||||
* should be TRUE (non-0) or FALSE (0) to indicate whether the 'button' is
|
||||
* pressed or released. If cmd.type is an axis, data1 holds the deflection
|
||||
* value. If cmd.type is a pointer, data1 and data2 are the positions of the
|
||||
* pointer.
|
||||
*/
|
||||
void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2);
|
||||
|
||||
/*******
|
||||
* These functions are called by snes9x into your port, so each port should
|
||||
* implement them.
|
||||
*/
|
||||
|
||||
/*
|
||||
* If something was mapped with poll=TRUE, these functions will be called when
|
||||
* snes9x needs the button/axis/pointer state. Fill in the reference options as
|
||||
* appropriate.
|
||||
*/
|
||||
bool S9xPollButton(uint32 id, bool *pressed);
|
||||
bool S9xPollPointer(uint32 id, int16 *x, int16 *y);
|
||||
bool S9xPollAxis(uint32 id, int16 *value);
|
||||
|
||||
/*
|
||||
* These are called when snes9x tries to apply a command with a S9x*Port type.
|
||||
* data1 and data2 are filled in like S9xApplyCommand.
|
||||
*/
|
||||
void S9xHandlePortCommand(s9xcommand_t cmd, int16 data1, int16 data2);
|
||||
|
||||
/* These are for your use */
|
||||
s9xcommand_t S9xGetPortCommandT(const char *name);
|
||||
char *S9xGetPortCommandName(s9xcommand_t command);
|
||||
void S9xSetupDefaultKeymap(void);
|
||||
bool8 S9xMapInput(const char *name, s9xcommand_t *cmd);
|
||||
|
||||
|
||||
/*******
|
||||
* These functions are called from snes9x into this subsystem. No need to use
|
||||
* them from a port.
|
||||
*/
|
||||
|
||||
/* Use when resetting snes9x */
|
||||
void S9xControlsReset(void);
|
||||
void S9xControlsSoftReset(void);
|
||||
|
||||
/* Use when writing to $4016 */
|
||||
void S9xSetJoypadLatch(bool latch);
|
||||
|
||||
/* Use when reading $4016/7 (JOYSER0 and JOYSER1) */
|
||||
uint8 S9xReadJOYSERn(int n);
|
||||
|
||||
/* End-Of-Frame processing. Sets gun latch variables and tries to draw
|
||||
* crosshairs */
|
||||
void S9xControlEOF(void);
|
||||
|
||||
struct SControlSnapshot {
|
||||
uint8 ver;
|
||||
uint8 port1_read_idx[2];
|
||||
uint8 dummy1[4]; // for future expansion
|
||||
uint8 port2_read_idx[2];
|
||||
uint8 dummy2[4];
|
||||
uint8 mouse_speed[2];
|
||||
uint8 justifier_select;
|
||||
uint8 dummy3[10];
|
||||
};
|
||||
|
||||
void S9xControlPreSave(struct SControlSnapshot *s);
|
||||
void S9xControlPostLoad(struct SControlSnapshot *s);
|
||||
|
||||
#endif
|
214
source/snes9x/copyright.h
Normal file
214
source/snes9x/copyright.h
Normal file
@ -0,0 +1,214 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
/*
|
||||
* Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
*
|
||||
* (c) Copyright 1996 - 2001 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
* Jerremy Koot (jkoot@snes9x.com)
|
||||
*
|
||||
* Super FX C emulator code
|
||||
* (c) Copyright 1997 - 1999 Ivar (ivar@snes9x.com) and
|
||||
* Gary Henderson.
|
||||
* Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
|
||||
*
|
||||
* DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson.
|
||||
* C4 asm and some C emulation code (c) Copyright 2000 zsKnight and _Demo_.
|
||||
* C4 C code (c) Copyright 2001 Gary Henderson (gary.henderson@ntlworld.com).
|
||||
*
|
||||
* DOS port code 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.
|
||||
*/
|
||||
/*
|
||||
* Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
*
|
||||
* (c) Copyright 1996, 1997, 1998, 1999 Gary Henderson (gary@daniver.demon.co.uk) and
|
||||
* Jerremy Koot (jkoot@snes9x.com)
|
||||
*
|
||||
* Super FX C emulator code (c) Copyright 1997, 1998 Ivar and
|
||||
* Gary Henderson.
|
||||
* Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
417
source/snes9x/cpu.cpp
Normal file
417
source/snes9x/cpu.cpp
Normal file
@ -0,0 +1,417 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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 "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "ppu.h"
|
||||
#include "dsp1.h"
|
||||
#include "cpuexec.h"
|
||||
#include "debug.h"
|
||||
#include "apu.h"
|
||||
#include "dma.h"
|
||||
#include "sa1.h"
|
||||
|
||||
#ifndef NGC
|
||||
#include "cheats.h"
|
||||
#endif
|
||||
|
||||
#include "srtc.h"
|
||||
#include "sdd1.h"
|
||||
#include "spc7110.h"
|
||||
#include "obc1.h"
|
||||
#include "bsx.h"
|
||||
#include "snapshot.h"
|
||||
|
||||
|
||||
#ifndef ZSNES_FX
|
||||
#include "fxemu.h"
|
||||
|
||||
extern struct FxInit_s SuperFX;
|
||||
|
||||
void S9xResetSuperFX ()
|
||||
{
|
||||
SuperFX.vFlags = 0; //FX_FLAG_ROM_BUFFER;// | FX_FLAG_ADDRESS_CHECKING;
|
||||
// FIXME: Snes9x can't execute CPU and SuperFX at a time. Don't ask me what is 0.417 :P
|
||||
SuperFX.speedPerLine = (uint32) (0.417 * 10.5e6 * ((1.0 / (float) Memory.ROMFramesPerSecond) / ((float) (Timings.V_Max))));
|
||||
//printf("SFX:%d\n", SuperFX.speedPerLine);
|
||||
SuperFX.oneLineDone = FALSE;
|
||||
FxReset (&SuperFX);
|
||||
}
|
||||
#endif
|
||||
|
||||
void S9xSoftResetCPU ()
|
||||
{
|
||||
Registers.PBPC = 0;
|
||||
Registers.PB = 0;
|
||||
Registers.PCw = S9xGetWord (0xFFFC);
|
||||
OpenBus = Registers.PCh;
|
||||
Registers.D.W = 0;
|
||||
Registers.DB = 0;
|
||||
Registers.SH = 1;
|
||||
Registers.SL -= 3;
|
||||
Registers.XH = 0;
|
||||
Registers.YH = 0;
|
||||
|
||||
ICPU.ShiftedPB = 0;
|
||||
ICPU.ShiftedDB = 0;
|
||||
SetFlags (MemoryFlag | IndexFlag | IRQ | Emulation);
|
||||
ClearFlags (Decimal);
|
||||
|
||||
CPU.Flags = CPU.Flags & (DEBUG_MODE_FLAG | TRACE_FLAG);
|
||||
CPU.BranchSkip = FALSE;
|
||||
CPU.NMIActive = FALSE;
|
||||
CPU.IRQActive = FALSE;
|
||||
CPU.WaitingForInterrupt = FALSE;
|
||||
CPU.InDMA = CPU.InWRAM_DMA = FALSE;
|
||||
CPU.PCBase = NULL;
|
||||
CPU.PBPCAtOpcodeStart = 0xffffffff;
|
||||
CPU.WaitAddress = 0xffffffff;
|
||||
CPU.WaitCounter = 0;
|
||||
CPU.Cycles = 182; // Or 188. This is the cycle count just after the jump to the Reset Vector.
|
||||
CPU.V_Counter = 0;
|
||||
CPU.MemSpeed = SLOW_ONE_CYCLE;
|
||||
CPU.MemSpeedx2 = SLOW_ONE_CYCLE * 2;
|
||||
CPU.FastROMSpeed = SLOW_ONE_CYCLE;
|
||||
CPU.AutoSaveTimer = 0;
|
||||
CPU.SRAMModified = FALSE;
|
||||
CPU.BRKTriggered = FALSE;
|
||||
//CPU.TriedInterleavedMode2 = FALSE; // Reset when ROM image loaded
|
||||
|
||||
Timings.InterlaceField = FALSE;
|
||||
Timings.H_Max = Timings.H_Max_Master;
|
||||
Timings.V_Max = Timings.V_Max_Master;
|
||||
Timings.NMITriggerPos = 0xffff;
|
||||
if (Model->_5A22 == 2)
|
||||
Timings.WRAMRefreshPos = SNES_WRAM_REFRESH_HC_v2;
|
||||
else
|
||||
Timings.WRAMRefreshPos = SNES_WRAM_REFRESH_HC_v1;
|
||||
|
||||
CPU.WhichEvent = HC_RENDER_EVENT;
|
||||
CPU.NextEvent = Timings.RenderPos;
|
||||
|
||||
S9xSetPCBase (Registers.PBPC);
|
||||
|
||||
ICPU.S9xOpcodes = S9xOpcodesE1;
|
||||
ICPU.S9xOpLengths = S9xOpLengthsM1X1;
|
||||
ICPU.CPUExecuting = TRUE;
|
||||
|
||||
S9xUnpackStatus();
|
||||
}
|
||||
|
||||
void S9xResetCPU ()
|
||||
{
|
||||
S9xSoftResetCPU ();
|
||||
Registers.SL = 0xFF;
|
||||
Registers.P.W = 0;
|
||||
SetFlags (MemoryFlag | IndexFlag | IRQ | Emulation);
|
||||
ClearFlags (Decimal);
|
||||
}
|
||||
|
||||
#ifdef ZSNES_FX
|
||||
START_EXTERN_C
|
||||
void S9xResetSuperFX ();
|
||||
bool8 WinterGold = 0;
|
||||
extern uint8 *C4Ram;
|
||||
END_EXTERN_C
|
||||
#endif
|
||||
|
||||
void S9xReset (void)
|
||||
{
|
||||
#ifndef NGC
|
||||
S9xResetSaveTimer (FALSE);
|
||||
#endif
|
||||
|
||||
ZeroMemory (Memory.FillRAM, 0x8000);
|
||||
memset (Memory.VRAM, 0x00, 0x10000);
|
||||
memset (Memory.RAM, 0x55, 0x20000);
|
||||
|
||||
if (Settings.BS)
|
||||
S9xResetBSX();
|
||||
if(Settings.SPC7110)
|
||||
S9xSpc7110Reset();
|
||||
S9xResetCPU ();
|
||||
S9xResetPPU ();
|
||||
S9xResetSRTC ();
|
||||
if (Settings.SDD1)
|
||||
S9xResetSDD1 ();
|
||||
|
||||
S9xResetDMA ();
|
||||
S9xResetAPU ();
|
||||
S9xResetDSP1 ();
|
||||
S9xSA1Init ();
|
||||
if (Settings.C4)
|
||||
S9xInitC4 ();
|
||||
|
||||
#ifndef NGC
|
||||
S9xInitCheatData ();
|
||||
#endif
|
||||
if (Settings.OBC1)
|
||||
ResetOBC1();
|
||||
if (Settings.SuperFX)
|
||||
S9xResetSuperFX ();
|
||||
#ifdef ZSNES_FX
|
||||
WinterGold = Settings.WinterGold;
|
||||
#endif
|
||||
// Settings.Paused = FALSE;
|
||||
}
|
||||
|
||||
void S9xSoftReset (void)
|
||||
{
|
||||
#ifndef NGC
|
||||
S9xResetSaveTimer (FALSE);
|
||||
#endif
|
||||
if (Settings.BS)
|
||||
S9xResetBSX();
|
||||
if (Settings.SuperFX)
|
||||
S9xResetSuperFX ();
|
||||
#ifdef ZSNES_FX
|
||||
WinterGold = Settings.WinterGold;
|
||||
#endif
|
||||
ZeroMemory (Memory.FillRAM, 0x8000);
|
||||
memset (Memory.VRAM, 0x00, 0x10000);
|
||||
// memset (Memory.RAM, 0x55, 0x20000);
|
||||
|
||||
if(Settings.SPC7110)
|
||||
S9xSpc7110Reset();
|
||||
S9xSoftResetCPU ();
|
||||
S9xSoftResetPPU ();
|
||||
S9xResetSRTC ();
|
||||
if (Settings.SDD1)
|
||||
S9xResetSDD1 ();
|
||||
|
||||
S9xResetDMA ();
|
||||
S9xResetAPU ();
|
||||
S9xResetDSP1 ();
|
||||
if(Settings.OBC1)
|
||||
ResetOBC1();
|
||||
S9xSA1Init ();
|
||||
if (Settings.C4)
|
||||
S9xInitC4 ();
|
||||
|
||||
#ifndef NGC
|
||||
S9xInitCheatData ();
|
||||
#endif
|
||||
|
||||
// Settings.Paused = FALSE;
|
||||
}
|
||||
|
||||
uint8 S9xOpLengthsM0X0[256] = {
|
||||
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 0
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 1
|
||||
3, 2, 4, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 2
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 3
|
||||
1, 2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 4
|
||||
2, 2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 4, 3, 3, 4, // 5
|
||||
1, 2, 3, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 6
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 7
|
||||
2, 2, 3, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 8
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 9
|
||||
3, 2, 3, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // A
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // B
|
||||
3, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // C
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // D
|
||||
3, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // E
|
||||
2, 2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4 // F
|
||||
};
|
||||
|
||||
uint8 S9xOpLengthsM0X1[256] = {
|
||||
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 0
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 1
|
||||
3, 2, 4, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 2
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 3
|
||||
1, 2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 4
|
||||
2, 2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 4, 3, 3, 4, // 5
|
||||
1, 2, 3, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 6
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 7
|
||||
2, 2, 3, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 8
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 9
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // A
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // B
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // C
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // D
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // E
|
||||
2, 2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4 // F
|
||||
};
|
||||
|
||||
uint8 S9xOpLengthsM1X0[256] = {
|
||||
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // 0
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 1
|
||||
3, 2, 4, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // 2
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 3
|
||||
1, 2, 2, 2, 3, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // 4
|
||||
2, 2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 4, 3, 3, 4, // 5
|
||||
1, 2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // 6
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 7
|
||||
2, 2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // 8
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 9
|
||||
3, 2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // A
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // B
|
||||
3, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // C
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // D
|
||||
3, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // E
|
||||
2, 2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4 // F
|
||||
};
|
||||
|
||||
uint8 S9xOpLengthsM1X1[256] = {
|
||||
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // 0
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 1
|
||||
3, 2, 4, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // 2
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 3
|
||||
1, 2, 2, 2, 3, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // 4
|
||||
2, 2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 4, 3, 3, 4, // 5
|
||||
1, 2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // 6
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 7
|
||||
2, 2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // 8
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // 9
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // A
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // B
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // C
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4, // D
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3, 3, 3, 4, // E
|
||||
2, 2, 2, 2, 3, 2, 2, 2, 1, 3, 1, 1, 3, 3, 3, 4 // F
|
||||
};
|
534
source/snes9x/cpuaddr.h
Normal file
534
source/snes9x/cpuaddr.h
Normal file
@ -0,0 +1,534 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _CPUADDR_H_
|
||||
#define _CPUADDR_H_
|
||||
|
||||
typedef enum {
|
||||
NONE = 0,
|
||||
READ = 1,
|
||||
WRITE = 2,
|
||||
MODIFY = 3,
|
||||
JUMP = 5,
|
||||
JSR = 8
|
||||
} AccessMode;
|
||||
|
||||
STATIC inline uint8 Immediate8 (AccessMode a) {
|
||||
uint8 val = CPU.PCBase[Registers.PCw];
|
||||
if(a&READ) OpenBus = val;
|
||||
AddCycles(CPU.MemSpeed);
|
||||
Registers.PCw++;
|
||||
return val;
|
||||
}
|
||||
|
||||
STATIC inline uint8 Immediate8Slow (AccessMode a) {
|
||||
uint8 val = S9xGetByte(Registers.PBPC);
|
||||
if(a&READ) OpenBus = val;
|
||||
Registers.PCw++;
|
||||
return val;
|
||||
}
|
||||
|
||||
STATIC inline uint16 Immediate16 (AccessMode a) {
|
||||
uint16 val = READ_WORD(CPU.PCBase+Registers.PCw);
|
||||
if(a&READ) OpenBus = (uint8)(val>>8);
|
||||
AddCycles(CPU.MemSpeedx2);
|
||||
Registers.PCw+=2;
|
||||
return val;
|
||||
}
|
||||
|
||||
STATIC inline uint16 Immediate16Slow (AccessMode a) {
|
||||
uint16 val = S9xGetWord(Registers.PBPC, WRAP_BANK);
|
||||
if(a&READ) OpenBus = (uint8)(val>>8);
|
||||
Registers.PCw+=2;
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
STATIC inline uint32 RelativeSlow (AccessMode a) { // branch $xx
|
||||
int8 offset = Immediate8Slow(a);
|
||||
return ((int16)Registers.PCw + offset) & 0xffff;
|
||||
}
|
||||
|
||||
STATIC inline uint32 Relative (AccessMode a) { // branch $xx
|
||||
int8 offset = Immediate8(a);
|
||||
return ((int16)Registers.PCw + offset) & 0xffff;
|
||||
}
|
||||
|
||||
STATIC inline uint32 RelativeLongSlow (AccessMode a) { // BRL $xxxx
|
||||
int16 offset = Immediate16Slow(a);
|
||||
return ((int32)Registers.PCw + offset) & 0xffff;
|
||||
}
|
||||
|
||||
STATIC inline uint32 RelativeLong (AccessMode a) { // BRL $xxxx
|
||||
int16 offset = Immediate16(a);
|
||||
return ((int32)Registers.PCw + offset) & 0xffff;
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndexedIndirectSlow (AccessMode a) { // (a,X)
|
||||
uint16 addr;
|
||||
if(a&JSR){
|
||||
// JSR (a,X) pushes the old address in the middle of loading the new.
|
||||
// OpenBus needs to be set to account for this.
|
||||
addr = Immediate8Slow(READ);
|
||||
if(a==JSR) OpenBus = Registers.PCl;
|
||||
addr |= Immediate8Slow(READ)<<8;
|
||||
} else {
|
||||
addr = Immediate16Slow(READ);
|
||||
}
|
||||
AddCycles(ONE_CYCLE);
|
||||
addr+=Registers.X.W;
|
||||
|
||||
// Address load wraps within the bank
|
||||
uint16 addr2 = S9xGetWord(ICPU.ShiftedPB | addr, WRAP_BANK);
|
||||
OpenBus = addr2>>8;
|
||||
return addr2;
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndexedIndirect (AccessMode a) { // (a,X)
|
||||
uint16 addr = Immediate16Slow(READ);
|
||||
addr+=Registers.X.W;
|
||||
|
||||
// Address load wraps within the bank
|
||||
uint16 addr2 = S9xGetWord(ICPU.ShiftedPB | addr, WRAP_BANK);
|
||||
OpenBus = addr2>>8;
|
||||
return addr2;
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndirectLongSlow (AccessMode a) { // [a]
|
||||
uint16 addr = Immediate16Slow(READ);
|
||||
|
||||
// No info on wrapping, but it doesn't matter anyway due to mirroring
|
||||
uint32 addr2 = S9xGetWord(addr);
|
||||
OpenBus=addr2>>8;
|
||||
addr2 |= (OpenBus = S9xGetByte(addr+2))<<16;
|
||||
return addr2;
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndirectLong (AccessMode a) { // [a]
|
||||
uint16 addr = Immediate16(READ);
|
||||
|
||||
// No info on wrapping, but it doesn't matter anyway due to mirroring
|
||||
uint32 addr2 = S9xGetWord(addr);
|
||||
OpenBus=addr2>>8;
|
||||
addr2 |= (OpenBus = S9xGetByte(addr+2))<<16;
|
||||
return addr2;
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndirectSlow (AccessMode a) { // (a)
|
||||
// No info on wrapping, but it doesn't matter anyway due to mirroring
|
||||
uint16 addr2 = S9xGetWord(Immediate16Slow(READ));
|
||||
OpenBus=addr2>>8;
|
||||
return addr2;
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndirect (AccessMode a) { // (a)
|
||||
// No info on wrapping, but it doesn't matter anyway due to mirroring
|
||||
uint16 addr2 = S9xGetWord(Immediate16(READ));
|
||||
OpenBus=addr2>>8;
|
||||
return addr2;
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteSlow (AccessMode a) { // a
|
||||
return ICPU.ShiftedDB|Immediate16Slow(a);
|
||||
}
|
||||
|
||||
STATIC inline uint32 Absolute (AccessMode a) { // a
|
||||
return ICPU.ShiftedDB|Immediate16(a);
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteLongSlow (AccessMode a) { // l
|
||||
uint32 addr = Immediate16Slow(READ);
|
||||
|
||||
// JSR l pushes the old bank in the middle of loading the new.
|
||||
// OpenBus needs to be set to account for this.
|
||||
if(a==JSR) OpenBus = Registers.PB;
|
||||
|
||||
addr |= Immediate8Slow(a)<<16;
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteLong (AccessMode a) { // l
|
||||
uint32 addr = READ_3WORD(CPU.PCBase+Registers.PCw);
|
||||
AddCycles(CPU.MemSpeedx2+CPU.MemSpeed);
|
||||
if(a&READ) OpenBus = addr>>16;
|
||||
Registers.PCw+=3;
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectSlow (AccessMode a) { // d
|
||||
uint16 addr = Immediate8Slow(a) + Registers.D.W;
|
||||
if(Registers.DL!=0) AddCycles(ONE_CYCLE);
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 Direct (AccessMode a) { // d
|
||||
uint16 addr = Immediate8(a) + Registers.D.W;
|
||||
if(Registers.DL!=0) AddCycles(ONE_CYCLE);
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectSlow (AccessMode a) { // (d)
|
||||
uint32 addr = S9xGetWord(DirectSlow(READ),
|
||||
(!CheckEmulation() || Registers.DL)?WRAP_BANK:WRAP_PAGE);
|
||||
if(a&READ) OpenBus=(uint8)(addr>>8);
|
||||
addr |= ICPU.ShiftedDB;
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectE0 (AccessMode a) { // (d)
|
||||
uint32 addr = S9xGetWord(Direct(READ));
|
||||
if(a&READ) OpenBus = (uint8)(addr>>8);
|
||||
addr |= ICPU.ShiftedDB;
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectE1 (AccessMode a) { // (d)
|
||||
uint32 addr = S9xGetWord(DirectSlow(READ),
|
||||
Registers.DL?WRAP_BANK:WRAP_PAGE);
|
||||
if(a&READ) OpenBus=(uint8)(addr>>8);
|
||||
addr |= ICPU.ShiftedDB;
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectIndexedSlow (AccessMode a) { // (d),Y
|
||||
uint32 addr = DirectIndirectSlow(a);
|
||||
if(a&WRITE || !CheckIndex() || (addr&0xff)+Registers.YL>=0x100) AddCycles(ONE_CYCLE);
|
||||
return (addr + Registers.Y.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectIndexedE0X0 (AccessMode a) { // (d),Y
|
||||
uint32 addr = DirectIndirectE0(a);
|
||||
AddCycles(ONE_CYCLE);
|
||||
return (addr + Registers.Y.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectIndexedE0X1 (AccessMode a) { // (d),Y
|
||||
uint32 addr = DirectIndirectE0(a);
|
||||
if(a&WRITE || (addr&0xff)+Registers.YL>=0x100) AddCycles(ONE_CYCLE);
|
||||
return (addr + Registers.Y.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectIndexedE1 (AccessMode a) { // (d),Y
|
||||
uint32 addr = DirectIndirectE1(a);
|
||||
if(a&WRITE || (addr&0xff)+Registers.YL>=0x100) AddCycles(ONE_CYCLE);
|
||||
return (addr + Registers.Y.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectLongSlow (AccessMode a) { // [d]
|
||||
uint16 addr = DirectSlow(READ);
|
||||
uint32 addr2 = S9xGetWord(addr);
|
||||
OpenBus=addr2>>8;
|
||||
addr2 |= (OpenBus = S9xGetByte(addr+2))<<16;
|
||||
return addr2;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectLong (AccessMode a) { // [d]
|
||||
uint16 addr = Direct(READ);
|
||||
uint32 addr2 = S9xGetWord(addr);
|
||||
OpenBus=addr2>>8;
|
||||
addr2 |= (OpenBus = S9xGetByte(addr+2))<<16;
|
||||
return addr2;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectIndexedLongSlow (AccessMode a) { // [d],Y
|
||||
return DirectIndirectLongSlow(a) + Registers.Y.W;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndirectIndexedLong (AccessMode a) { // [d],Y
|
||||
return DirectIndirectLong(a) + Registers.Y.W;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndexedXSlow (AccessMode a) { // d,X
|
||||
pair addr;
|
||||
addr.W = DirectSlow(a);
|
||||
if(!CheckEmulation() || Registers.DL){
|
||||
addr.W+=Registers.X.W;
|
||||
} else {
|
||||
addr.B.l+=Registers.XL;
|
||||
}
|
||||
AddCycles(ONE_CYCLE);
|
||||
return addr.W;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndexedXE0 (AccessMode a) { // d,X
|
||||
uint16 addr = Direct(a) + Registers.X.W;
|
||||
AddCycles(ONE_CYCLE);
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndexedXE1 (AccessMode a) { // d,X
|
||||
if(Registers.DL){
|
||||
return DirectIndexedXE0(a);
|
||||
} else {
|
||||
pair addr;
|
||||
addr.W = Direct(a);
|
||||
addr.B.l+=Registers.XL;
|
||||
AddCycles(ONE_CYCLE);
|
||||
return addr.W;
|
||||
}
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndexedYSlow (AccessMode a) { // d,Y
|
||||
pair addr;
|
||||
addr.W = DirectSlow(a);
|
||||
if(!CheckEmulation() || Registers.DL){
|
||||
addr.W+=Registers.Y.W;
|
||||
} else {
|
||||
addr.B.l+=Registers.YL;
|
||||
}
|
||||
AddCycles(ONE_CYCLE);
|
||||
return addr.W;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndexedYE0 (AccessMode a) { // d,Y
|
||||
uint16 addr = Direct(a) + Registers.Y.W;
|
||||
AddCycles(ONE_CYCLE);
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndexedYE1 (AccessMode a) { // d,Y
|
||||
if(Registers.DL){
|
||||
return DirectIndexedYE0(a);
|
||||
} else {
|
||||
pair addr;
|
||||
addr.W = Direct(a);
|
||||
addr.B.l+=Registers.YL;
|
||||
AddCycles(ONE_CYCLE);
|
||||
return addr.W;
|
||||
}
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndexedIndirectSlow (AccessMode a) { // (d,X)
|
||||
uint32 addr = S9xGetWord(DirectIndexedXSlow(READ),
|
||||
(!CheckEmulation() || Registers.DL)?WRAP_BANK:WRAP_PAGE);
|
||||
if(a&READ) OpenBus=(uint8)(addr>>8);
|
||||
return ICPU.ShiftedDB|addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndexedIndirectE0 (AccessMode a) { // (d,X)
|
||||
uint32 addr = S9xGetWord(DirectIndexedXE0(READ));
|
||||
if(a&READ) OpenBus = (uint8)(addr>>8);
|
||||
return ICPU.ShiftedDB|addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 DirectIndexedIndirectE1 (AccessMode a) { // (d,X)
|
||||
uint32 addr = S9xGetWord(DirectIndexedXE1(READ),
|
||||
Registers.DL?WRAP_BANK:WRAP_PAGE);
|
||||
if(a&READ) OpenBus=(uint8)(addr>>8);
|
||||
return ICPU.ShiftedDB|addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndexedXSlow (AccessMode a) { // a,X
|
||||
uint32 addr = AbsoluteSlow(a);
|
||||
if(a&WRITE || !CheckIndex() || (addr&0xff)+Registers.XL>=0x100) AddCycles(ONE_CYCLE);
|
||||
return (addr + Registers.X.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndexedXX0 (AccessMode a) { // a,X
|
||||
uint32 addr = Absolute(a);
|
||||
AddCycles(ONE_CYCLE);
|
||||
return (addr + Registers.X.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndexedXX1 (AccessMode a) { // a,X
|
||||
uint32 addr = Absolute(a);
|
||||
if(a&WRITE || (addr&0xff)+Registers.XL>=0x100) AddCycles(ONE_CYCLE);
|
||||
return (addr + Registers.X.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndexedYSlow (AccessMode a) { // a,Y
|
||||
uint32 addr = AbsoluteSlow(a);
|
||||
if(a&WRITE || !CheckIndex() || (addr&0xff)+Registers.YL>=0x100) AddCycles(ONE_CYCLE);
|
||||
return (addr + Registers.Y.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndexedYX0 (AccessMode a) { // a,Y
|
||||
uint32 addr = Absolute(a);
|
||||
AddCycles(ONE_CYCLE);
|
||||
return (addr + Registers.Y.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteIndexedYX1 (AccessMode a) { // a,Y
|
||||
uint32 addr = Absolute(a);
|
||||
if(a&WRITE || (addr&0xff)+Registers.YL>=0x100) AddCycles(ONE_CYCLE);
|
||||
return (addr + Registers.Y.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteLongIndexedXSlow (AccessMode a) { // l,X
|
||||
return (AbsoluteLongSlow(a) + Registers.X.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 AbsoluteLongIndexedX (AccessMode a) { // l,X
|
||||
return (AbsoluteLong(a) + Registers.X.W);
|
||||
}
|
||||
|
||||
STATIC inline uint32 StackRelativeSlow (AccessMode a) { // d,S
|
||||
uint16 addr = Immediate8Slow(a) + Registers.S.W;
|
||||
AddCycles(ONE_CYCLE);
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 StackRelative (AccessMode a) { // d,S
|
||||
uint16 addr = Immediate8(a) + Registers.S.W;
|
||||
AddCycles(ONE_CYCLE);
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 StackRelativeIndirectIndexedSlow (AccessMode a) { // (d,S),Y
|
||||
uint32 addr=S9xGetWord(StackRelativeSlow(READ));
|
||||
if(a&READ) OpenBus = (uint8)(addr>>8);
|
||||
addr = (addr+Registers.Y.W+ICPU.ShiftedDB)&0xffffff;
|
||||
AddCycles(ONE_CYCLE);
|
||||
return addr;
|
||||
}
|
||||
|
||||
STATIC inline uint32 StackRelativeIndirectIndexed (AccessMode a) { // (d,S),Y
|
||||
uint32 addr=S9xGetWord(StackRelative(READ));
|
||||
if(a&READ) OpenBus = (uint8)(addr>>8);
|
||||
addr = (addr+Registers.Y.W+ICPU.ShiftedDB)&0xffffff;
|
||||
AddCycles(ONE_CYCLE);
|
||||
return addr;
|
||||
}
|
||||
#endif
|
||||
|
517
source/snes9x/cpuexec.cpp
Normal file
517
source/snes9x/cpuexec.cpp
Normal file
@ -0,0 +1,517 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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 "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "cpuops.h"
|
||||
#include "ppu.h"
|
||||
#include "cpuexec.h"
|
||||
#include "debug.h"
|
||||
#include "snapshot.h"
|
||||
#include "gfx.h"
|
||||
#include "missing.h"
|
||||
#include "apu.h"
|
||||
#include "dma.h"
|
||||
#include "sa1.h"
|
||||
#include "spc7110.h"
|
||||
|
||||
#ifndef ZSNES_FX
|
||||
#include "fxemu.h"
|
||||
extern struct FxInit_s SuperFX;
|
||||
#endif
|
||||
|
||||
void S9xMainLoop (void)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
APU_EXECUTE();
|
||||
|
||||
if (CPU.Flags)
|
||||
{
|
||||
if (CPU.Flags & NMI_FLAG)
|
||||
{
|
||||
if (Timings.NMITriggerPos <= CPU.Cycles)
|
||||
{
|
||||
CPU.Flags &= ~NMI_FLAG;
|
||||
Timings.NMITriggerPos = 0xffff;
|
||||
if (CPU.WaitingForInterrupt)
|
||||
{
|
||||
CPU.WaitingForInterrupt = FALSE;
|
||||
Registers.PCw++;
|
||||
}
|
||||
|
||||
S9xOpcode_NMI();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUGGER
|
||||
if ((CPU.Flags & BREAK_FLAG) && !(CPU.Flags & SINGLE_STEP_FLAG))
|
||||
{
|
||||
for (int Break = 0; Break != 6; Break++)
|
||||
{
|
||||
if (S9xBreakpoint[Break].Enabled &&
|
||||
S9xBreakpoint[Break].Bank == Registers.PB &&
|
||||
S9xBreakpoint[Break].Address == Registers.PCw)
|
||||
{
|
||||
if (S9xBreakpoint[Break].Enabled == 2)
|
||||
S9xBreakpoint[Break].Enabled = TRUE;
|
||||
else
|
||||
CPU.Flags |= DEBUG_MODE_FLAG;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
CHECK_SOUND();
|
||||
|
||||
if (CPU.Flags & IRQ_PENDING_FLAG)
|
||||
{
|
||||
if (CPU.WaitingForInterrupt)
|
||||
{
|
||||
CPU.WaitingForInterrupt = FALSE;
|
||||
Registers.PCw++;
|
||||
}
|
||||
|
||||
if (CPU.IRQActive && !Settings.DisableIRQ)
|
||||
{
|
||||
if (!CheckFlag(IRQ))
|
||||
S9xOpcode_IRQ();
|
||||
}
|
||||
else
|
||||
CPU.Flags &= ~IRQ_PENDING_FLAG;
|
||||
}
|
||||
|
||||
if (CPU.Flags & SCAN_KEYS_FLAG)
|
||||
break;
|
||||
|
||||
#ifdef DEBUGGER
|
||||
if (CPU.Flags & DEBUG_MODE_FLAG)
|
||||
break;
|
||||
|
||||
if (CPU.Flags & TRACE_FLAG)
|
||||
S9xTrace();
|
||||
|
||||
if (CPU.Flags & SINGLE_STEP_FLAG)
|
||||
{
|
||||
CPU.Flags &= ~SINGLE_STEP_FLAG;
|
||||
CPU.Flags |= DEBUG_MODE_FLAG;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CPU_SHUTDOWN
|
||||
CPU.PBPCAtOpcodeStart = Registers.PBPC;
|
||||
#endif
|
||||
|
||||
register uint8 Op;
|
||||
register struct SOpcodes *Opcodes;
|
||||
|
||||
if (CPU.PCBase)
|
||||
{
|
||||
Op = CPU.PCBase[Registers.PCw];
|
||||
CPU.Cycles += CPU.MemSpeed;
|
||||
Opcodes = ICPU.S9xOpcodes;
|
||||
}
|
||||
else
|
||||
{
|
||||
Op = S9xGetByte(Registers.PBPC);
|
||||
OpenBus = Op;
|
||||
Opcodes = S9xOpcodesSlow;
|
||||
}
|
||||
|
||||
if ((Registers.PCw&MEMMAP_MASK) + ICPU.S9xOpLengths[Op] >= MEMMAP_BLOCK_SIZE)
|
||||
{
|
||||
uint8 *oldPCBase = CPU.PCBase;
|
||||
|
||||
CPU.PCBase = GetBasePointer(ICPU.ShiftedPB + ((uint16) (Registers.PCw + 4)));
|
||||
if (oldPCBase!=CPU.PCBase || (Registers.PCw&~MEMMAP_MASK) == (0xffff & ~MEMMAP_MASK))
|
||||
Opcodes = S9xOpcodesSlow;
|
||||
}
|
||||
|
||||
Registers.PCw++;
|
||||
(*Opcodes[Op].S9xOpcode)();
|
||||
|
||||
S9xUpdateAPUTimer();
|
||||
|
||||
if (SA1.Executing)
|
||||
S9xSA1MainLoop();
|
||||
|
||||
if (CPU.Cycles >= CPU.NextEvent)
|
||||
S9xDoHEventProcessing();
|
||||
}
|
||||
|
||||
S9xPackStatus();
|
||||
APURegisters.PC = IAPU.PC - IAPU.RAM;
|
||||
S9xAPUPackStatus();
|
||||
|
||||
if (CPU.Flags & SCAN_KEYS_FLAG)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
if (!(CPU.Flags & FRAME_ADVANCE_FLAG))
|
||||
#endif
|
||||
S9xSyncSpeed();
|
||||
CPU.Flags &= ~SCAN_KEYS_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
void S9xSetIRQ (uint32 source)
|
||||
{
|
||||
CPU.IRQActive |= source;
|
||||
CPU.Flags |= IRQ_PENDING_FLAG;
|
||||
|
||||
if (CPU.WaitingForInterrupt)
|
||||
{
|
||||
// Force IRQ to trigger immediately after WAI -
|
||||
// Final Fantasy Mystic Quest crashes without this.
|
||||
CPU.WaitingForInterrupt = FALSE;
|
||||
Registers.PCw++;
|
||||
}
|
||||
}
|
||||
|
||||
void S9xClearIRQ (uint32 source)
|
||||
{
|
||||
CLEAR_IRQ_SOURCE(source);
|
||||
}
|
||||
|
||||
void S9xDoHEventProcessing (void)
|
||||
{
|
||||
#ifdef CPU_SHUTDOWN
|
||||
CPU.WaitCounter++;
|
||||
#endif
|
||||
switch (CPU.WhichEvent)
|
||||
{
|
||||
case HC_HBLANK_START_EVENT:
|
||||
S9xCheckMissingHTimerPosition(Timings.HBlankStart);
|
||||
|
||||
break;
|
||||
|
||||
case HC_HDMA_START_EVENT:
|
||||
if (IPPU.HDMA && CPU.V_Counter <= PPU.ScreenHeight)
|
||||
IPPU.HDMA = S9xDoHDMA(IPPU.HDMA);
|
||||
|
||||
S9xCheckMissingHTimerPosition(Timings.HDMAStart);
|
||||
|
||||
break;
|
||||
|
||||
case HC_HCOUNTER_MAX_EVENT:
|
||||
#ifndef ZSNES_FX
|
||||
if (Settings.SuperFX)
|
||||
{
|
||||
if (!SuperFX.oneLineDone)
|
||||
S9xSuperFXExec();
|
||||
SuperFX.oneLineDone = FALSE;
|
||||
}
|
||||
#else
|
||||
S9xSuperFXExec();
|
||||
#endif
|
||||
|
||||
#ifndef STORM
|
||||
if (Settings.SoundSync)
|
||||
S9xGenerateSound();
|
||||
#endif
|
||||
|
||||
CPU.Cycles -= Timings.H_Max;
|
||||
IAPU.NextAPUTimerPos -= (Timings.H_Max << SNES_APUTIMER_ACCURACY);
|
||||
if (IAPU.APUExecuting)
|
||||
APU.Cycles -= Timings.H_Max;
|
||||
else
|
||||
APU.Cycles = 0;
|
||||
if ((Timings.NMITriggerPos != 0xffff) && (Timings.NMITriggerPos >= Timings.H_Max))
|
||||
Timings.NMITriggerPos -= Timings.H_Max;
|
||||
|
||||
ICPU.Scanline++;
|
||||
|
||||
CPU.V_Counter++;
|
||||
if (CPU.V_Counter >= Timings.V_Max) // V ranges from 0 to Timings.V_Max - 1
|
||||
{
|
||||
CPU.V_Counter = 0;
|
||||
Timings.InterlaceField ^= 1;
|
||||
|
||||
// From byuu:
|
||||
// [NTSC]
|
||||
// interlace mode has 525 scanlines: 263 on the even frame, and 262 on the odd.
|
||||
// non-interlace mode has 524 scanlines: 262 scanlines on both even and odd frames.
|
||||
// [PAL] <PAL info is unverified on hardware>
|
||||
// interlace mode has 625 scanlines: 313 on the even frame, and 312 on the odd.
|
||||
// non-interlace mode has 624 scanlines: 312 scanlines on both even and odd frames.
|
||||
if (IPPU.Interlace && !Timings.InterlaceField)
|
||||
Timings.V_Max = Timings.V_Max_Master + 1; // 263 (NTSC), 313?(PAL)
|
||||
else
|
||||
Timings.V_Max = Timings.V_Max_Master; // 262 (NTSC), 312?(PAL)
|
||||
|
||||
Memory.FillRAM[0x213F] ^= 0x80;
|
||||
PPU.RangeTimeOver = 0;
|
||||
|
||||
// FIXME: reading $4210 will wait 2 cycles, then perform reading, then wait 4 more cycles.
|
||||
Memory.FillRAM[0x4210] = Model->_5A22;
|
||||
CPU.Flags &= ~NMI_FLAG;
|
||||
Timings.NMITriggerPos = 0xffff;
|
||||
|
||||
ICPU.Frame++;
|
||||
PPU.HVBeamCounterLatched = 0;
|
||||
CPU.Flags |= SCAN_KEYS_FLAG;
|
||||
}
|
||||
|
||||
// From byuu:
|
||||
// In non-interlace mode, there are 341 dots per scanline, and 262 scanlines per frame.
|
||||
// On odd frames, scanline 240 is one dot short.
|
||||
// In interlace mode, there are always 341 dots per scanline. Even frames have 263 scanlines,
|
||||
// and odd frames have 262 scanlines.
|
||||
// Interlace mode scanline 240 on odd frames is not missing a dot.
|
||||
if (CPU.V_Counter == 240 && !IPPU.Interlace && Timings.InterlaceField) // V=240
|
||||
Timings.H_Max = Timings.H_Max_Master - ONE_DOT_CYCLE; // HC=1360
|
||||
else
|
||||
Timings.H_Max = Timings.H_Max_Master; // HC=1364
|
||||
|
||||
if (Model->_5A22 == 2)
|
||||
{
|
||||
if (CPU.V_Counter != 240 || IPPU.Interlace || !Timings.InterlaceField) // V=240
|
||||
{
|
||||
if (Timings.WRAMRefreshPos == SNES_WRAM_REFRESH_HC_v2 - ONE_DOT_CYCLE) // HC=534
|
||||
Timings.WRAMRefreshPos = SNES_WRAM_REFRESH_HC_v2; // HC=538
|
||||
else
|
||||
Timings.WRAMRefreshPos = SNES_WRAM_REFRESH_HC_v2 - ONE_DOT_CYCLE; // HC=534
|
||||
}
|
||||
}
|
||||
else
|
||||
Timings.WRAMRefreshPos = SNES_WRAM_REFRESH_HC_v1;
|
||||
|
||||
S9xCheckMissingHTimerPosition(0);
|
||||
|
||||
if (CPU.V_Counter == PPU.ScreenHeight + FIRST_VISIBLE_LINE) // VBlank starts from V=225(240).
|
||||
{
|
||||
S9xEndScreenRefresh();
|
||||
IPPU.HDMA = 0;
|
||||
// Bits 7 and 6 of $4212 are computed when read in S9xGetPPU.
|
||||
#ifdef DEBUGGER
|
||||
missing.dma_this_frame = 0;
|
||||
#endif
|
||||
IPPU.MaxBrightness = PPU.Brightness;
|
||||
PPU.ForcedBlanking = (Memory.FillRAM [0x2100] >> 7) & 1;
|
||||
|
||||
if (!PPU.ForcedBlanking)
|
||||
{
|
||||
PPU.OAMAddr = PPU.SavedOAMAddr;
|
||||
|
||||
uint8 tmp = 0;
|
||||
|
||||
if (PPU.OAMPriorityRotation)
|
||||
tmp = (PPU.OAMAddr & 0xFE) >> 1;
|
||||
if ((PPU.OAMFlip & 1) || PPU.FirstSprite!=tmp)
|
||||
{
|
||||
PPU.FirstSprite = tmp;
|
||||
IPPU.OBJChanged = TRUE;
|
||||
}
|
||||
|
||||
PPU.OAMFlip = 0;
|
||||
}
|
||||
|
||||
// FIXME: writing to $4210 will wait 6 cycles.
|
||||
Memory.FillRAM[0x4210] = 0x80 | Model->_5A22;
|
||||
if (Memory.FillRAM[0x4200] & 0x80)
|
||||
{
|
||||
// FIXME: triggered at HC=6, checked just before the final CPU cycle,
|
||||
// then, when to call S9xOpcode_NMI()?
|
||||
CPU.Flags |= NMI_FLAG;
|
||||
Timings.NMITriggerPos = 6 + 6;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (CPU.V_Counter == PPU.ScreenHeight + 3) // FIXME: not true
|
||||
S9xDoAutoJoypad();
|
||||
|
||||
if (CPU.V_Counter == FIRST_VISIBLE_LINE) // V=1
|
||||
S9xStartScreenRefresh();
|
||||
|
||||
CPU.NextEvent = -1;
|
||||
|
||||
break;
|
||||
|
||||
case HC_HDMA_INIT_EVENT:
|
||||
if (CPU.V_Counter == 0)
|
||||
S9xStartHDMA();
|
||||
|
||||
S9xCheckMissingHTimerPosition(Timings.HDMAInit);
|
||||
|
||||
break;
|
||||
|
||||
case HC_RENDER_EVENT:
|
||||
if (CPU.V_Counter >= FIRST_VISIBLE_LINE && CPU.V_Counter <= PPU.ScreenHeight)
|
||||
RenderLine(CPU.V_Counter - FIRST_VISIBLE_LINE);
|
||||
|
||||
S9xCheckMissingHTimerPosition(Timings.RenderPos);
|
||||
|
||||
break;
|
||||
|
||||
case HC_WRAM_REFRESH_EVENT:
|
||||
if (!CPU.InDMA)
|
||||
{
|
||||
S9xCheckMissingHTimerPositionRange(Timings.WRAMRefreshPos, SNES_WRAM_REFRESH_CYCLES);
|
||||
CPU.Cycles += SNES_WRAM_REFRESH_CYCLES;
|
||||
S9xUpdateAPUTimer();
|
||||
APU_EXECUTE();
|
||||
}
|
||||
else
|
||||
S9xCheckMissingHTimerPosition(Timings.WRAMRefreshPos);
|
||||
|
||||
break;
|
||||
|
||||
case HC_IRQ_1_3_EVENT:
|
||||
case HC_IRQ_3_5_EVENT:
|
||||
case HC_IRQ_5_7_EVENT:
|
||||
case HC_IRQ_7_9_EVENT:
|
||||
case HC_IRQ_9_A_EVENT:
|
||||
case HC_IRQ_A_1_EVENT:
|
||||
if (PPU.HTimerEnabled && (!PPU.VTimerEnabled || (CPU.V_Counter == PPU.VTimerPosition)))
|
||||
S9xSetIRQ(PPU_H_BEAM_IRQ_SOURCE);
|
||||
else
|
||||
if (PPU.VTimerEnabled && (CPU.V_Counter == PPU.VTimerPosition))
|
||||
S9xSetIRQ(PPU_V_BEAM_IRQ_SOURCE);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
S9xReschedule();
|
||||
}
|
341
source/snes9x/cpuexec.h
Normal file
341
source/snes9x/cpuexec.h
Normal file
@ -0,0 +1,341 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _CPUEXEC_H_
|
||||
#define _CPUEXEC_H_
|
||||
|
||||
#include "snes9x.h"
|
||||
|
||||
struct SOpcodes {
|
||||
#ifdef __WIN32__
|
||||
void (__cdecl *S9xOpcode)( void);
|
||||
#else
|
||||
void (*S9xOpcode)( void);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct SICPU
|
||||
{
|
||||
uint8 *Speed;
|
||||
struct SOpcodes *S9xOpcodes;
|
||||
uint8 *S9xOpLengths;
|
||||
uint8 _Carry;
|
||||
uint8 _Zero;
|
||||
uint8 _Negative;
|
||||
uint8 _Overflow;
|
||||
bool8 CPUExecuting;
|
||||
uint32 ShiftedPB;
|
||||
uint32 ShiftedDB;
|
||||
uint32 Frame;
|
||||
uint32 Scanline;
|
||||
uint32 FrameAdvanceCount;
|
||||
};
|
||||
|
||||
START_EXTERN_C
|
||||
extern struct SICPU ICPU;
|
||||
END_EXTERN_C
|
||||
|
||||
#include "ppu.h"
|
||||
#include "memmap.h"
|
||||
#include "65c816.h"
|
||||
|
||||
START_EXTERN_C
|
||||
void S9xMainLoop (void);
|
||||
void S9xReset (void);
|
||||
void S9xSoftReset (void);
|
||||
void S9xDoHEventProcessing ();
|
||||
void S9xClearIRQ (uint32);
|
||||
void S9xSetIRQ (uint32);
|
||||
|
||||
extern struct SOpcodes S9xOpcodesE1 [256];
|
||||
extern struct SOpcodes S9xOpcodesM1X1 [256];
|
||||
extern struct SOpcodes S9xOpcodesM1X0 [256];
|
||||
extern struct SOpcodes S9xOpcodesM0X1 [256];
|
||||
extern struct SOpcodes S9xOpcodesM0X0 [256];
|
||||
extern struct SOpcodes S9xOpcodesSlow [256];
|
||||
extern uint8 S9xOpLengthsM1X1 [256];
|
||||
extern uint8 S9xOpLengthsM1X0 [256];
|
||||
extern uint8 S9xOpLengthsM0X1 [256];
|
||||
extern uint8 S9xOpLengthsM0X0 [256];
|
||||
END_EXTERN_C
|
||||
|
||||
STATIC inline void S9xUnpackStatus()
|
||||
{
|
||||
ICPU._Zero = (Registers.PL & Zero) == 0;
|
||||
ICPU._Negative = (Registers.PL & Negative);
|
||||
ICPU._Carry = (Registers.PL & Carry);
|
||||
ICPU._Overflow = (Registers.PL & Overflow) >> 6;
|
||||
}
|
||||
|
||||
STATIC inline void S9xPackStatus()
|
||||
{
|
||||
Registers.PL &= ~(Zero | Negative | Carry | Overflow);
|
||||
Registers.PL |= ICPU._Carry | ((ICPU._Zero == 0) << 1) |
|
||||
(ICPU._Negative & 0x80) | (ICPU._Overflow << 6);
|
||||
}
|
||||
|
||||
STATIC inline void CLEAR_IRQ_SOURCE (uint32 M)
|
||||
{
|
||||
CPU.IRQActive &= ~M;
|
||||
if (!CPU.IRQActive)
|
||||
CPU.Flags &= ~IRQ_PENDING_FLAG;
|
||||
}
|
||||
|
||||
STATIC inline void S9xFixCycles ()
|
||||
{
|
||||
if (CheckEmulation ())
|
||||
{
|
||||
ICPU.S9xOpcodes = S9xOpcodesE1;
|
||||
ICPU.S9xOpLengths = S9xOpLengthsM1X1;
|
||||
}
|
||||
else
|
||||
if (CheckMemory ())
|
||||
{
|
||||
if (CheckIndex ())
|
||||
{
|
||||
ICPU.S9xOpcodes = S9xOpcodesM1X1;
|
||||
ICPU.S9xOpLengths = S9xOpLengthsM1X1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ICPU.S9xOpcodes = S9xOpcodesM1X0;
|
||||
ICPU.S9xOpLengths = S9xOpLengthsM1X0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CheckIndex ())
|
||||
{
|
||||
ICPU.S9xOpcodes = S9xOpcodesM0X1;
|
||||
ICPU.S9xOpLengths = S9xOpLengthsM0X1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ICPU.S9xOpcodes = S9xOpcodesM0X0;
|
||||
ICPU.S9xOpLengths = S9xOpLengthsM0X0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
STATIC inline void S9xReschedule (void)
|
||||
{
|
||||
uint8 next = 0;
|
||||
int32 hpos = 0;
|
||||
|
||||
switch (CPU.WhichEvent)
|
||||
{
|
||||
case HC_HBLANK_START_EVENT:
|
||||
case HC_IRQ_1_3_EVENT:
|
||||
next = HC_HDMA_START_EVENT;
|
||||
hpos = Timings.HDMAStart;
|
||||
break;
|
||||
|
||||
case HC_HDMA_START_EVENT:
|
||||
case HC_IRQ_3_5_EVENT:
|
||||
next = HC_HCOUNTER_MAX_EVENT;
|
||||
hpos = Timings.H_Max;
|
||||
break;
|
||||
|
||||
case HC_HCOUNTER_MAX_EVENT:
|
||||
case HC_IRQ_5_7_EVENT:
|
||||
next = HC_HDMA_INIT_EVENT;
|
||||
hpos = Timings.HDMAInit;
|
||||
break;
|
||||
|
||||
case HC_HDMA_INIT_EVENT:
|
||||
case HC_IRQ_7_9_EVENT:
|
||||
next = HC_RENDER_EVENT;
|
||||
hpos = Timings.RenderPos;
|
||||
break;
|
||||
|
||||
case HC_RENDER_EVENT:
|
||||
case HC_IRQ_9_A_EVENT:
|
||||
next = HC_WRAM_REFRESH_EVENT;
|
||||
hpos = Timings.WRAMRefreshPos;
|
||||
break;
|
||||
|
||||
case HC_WRAM_REFRESH_EVENT:
|
||||
case HC_IRQ_A_1_EVENT:
|
||||
next = HC_HBLANK_START_EVENT;
|
||||
hpos = Timings.HBlankStart;
|
||||
break;
|
||||
}
|
||||
|
||||
if (((int32) PPU.HTimerPosition > CPU.NextEvent) && ((int32) PPU.HTimerPosition < hpos))
|
||||
{
|
||||
hpos = (int32) PPU.HTimerPosition;
|
||||
|
||||
switch (next)
|
||||
{
|
||||
case HC_HDMA_START_EVENT:
|
||||
next = HC_IRQ_1_3_EVENT;
|
||||
break;
|
||||
|
||||
case HC_HCOUNTER_MAX_EVENT:
|
||||
next = HC_IRQ_3_5_EVENT;
|
||||
break;
|
||||
|
||||
case HC_HDMA_INIT_EVENT:
|
||||
next = HC_IRQ_5_7_EVENT;
|
||||
break;
|
||||
|
||||
case HC_RENDER_EVENT:
|
||||
next = HC_IRQ_7_9_EVENT;
|
||||
break;
|
||||
|
||||
case HC_WRAM_REFRESH_EVENT:
|
||||
next = HC_IRQ_9_A_EVENT;
|
||||
break;
|
||||
|
||||
case HC_HBLANK_START_EVENT:
|
||||
next = HC_IRQ_A_1_EVENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CPU.NextEvent = hpos;
|
||||
CPU.WhichEvent = next;
|
||||
}
|
||||
|
||||
#endif
|
781
source/snes9x/cpumacro.h
Normal file
781
source/snes9x/cpumacro.h
Normal file
@ -0,0 +1,781 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _CPUMACRO_H_
|
||||
#define _CPUMACRO_H_
|
||||
|
||||
#define rOP8(OP, ADDR, WRAP, FUNC) \
|
||||
static void Op##OP (void) { \
|
||||
uint8 val = OpenBus = S9xGetByte(ADDR(READ)); \
|
||||
FUNC(val); \
|
||||
}
|
||||
|
||||
#define rOP16(OP, ADDR, WRAP, FUNC) \
|
||||
static void Op##OP (void) { \
|
||||
uint16 val = S9xGetWord(ADDR(READ), WRAP); \
|
||||
OpenBus = (uint8)(val>>8); \
|
||||
FUNC(val); \
|
||||
}
|
||||
|
||||
#define rOPC(OP, COND, ADDR, WRAP, FUNC) \
|
||||
static void Op##OP (void) { \
|
||||
if(Check##COND()){ \
|
||||
uint8 val = OpenBus = S9xGetByte(ADDR(READ)); \
|
||||
FUNC(val); \
|
||||
} else { \
|
||||
uint16 val = S9xGetWord(ADDR(READ), WRAP); \
|
||||
OpenBus = (uint8)(val>>8); \
|
||||
FUNC(val); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define rOPM(OP, ADDR, WRAP, FUNC) \
|
||||
rOPC(OP, Memory, ADDR, WRAP, FUNC)
|
||||
|
||||
#define rOPX(OP, ADDR, WRAP, FUNC) \
|
||||
rOPC(OP, Index, ADDR, WRAP, FUNC)
|
||||
|
||||
|
||||
#define wOP8(OP, ADDR, WRAP, FUNC) \
|
||||
static void Op##OP (void) { \
|
||||
FUNC##8 (ADDR(WRITE)); \
|
||||
}
|
||||
|
||||
#define wOP16(OP, ADDR, WRAP, FUNC) \
|
||||
static void Op##OP (void) { \
|
||||
FUNC##16 (ADDR(WRITE), WRAP); \
|
||||
}
|
||||
|
||||
#define wOPC(OP, COND, ADDR, WRAP, FUNC) \
|
||||
static void Op##OP (void) { \
|
||||
if(Check##COND()){ \
|
||||
FUNC##8 (ADDR(WRITE)); \
|
||||
} else { \
|
||||
FUNC##16 (ADDR(WRITE), WRAP); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define wOPM(OP, ADDR, WRAP, FUNC) \
|
||||
wOPC(OP, Memory, ADDR, WRAP, FUNC)
|
||||
|
||||
#define wOPX(OP, ADDR, WRAP, FUNC) \
|
||||
wOPC(OP, Index, ADDR, WRAP, FUNC)
|
||||
|
||||
|
||||
#define mOP8(OP, ADDR, WRAP, FUNC) \
|
||||
static void Op##OP (void) { \
|
||||
FUNC##8 (ADDR(MODIFY)); \
|
||||
}
|
||||
|
||||
#define mOP16(OP, ADDR, WRAP, FUNC) \
|
||||
static void Op##OP (void) { \
|
||||
FUNC##16 (ADDR(MODIFY), WRAP); \
|
||||
}
|
||||
|
||||
#define mOPC(OP, COND, ADDR, WRAP, FUNC) \
|
||||
static void Op##OP (void) { \
|
||||
if(Check##COND()){ \
|
||||
FUNC##8 (ADDR(MODIFY)); \
|
||||
} else { \
|
||||
FUNC##16 (ADDR(MODIFY), WRAP); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define mOPM(OP, ADDR, WRAP, FUNC) \
|
||||
mOPC(OP, Memory, ADDR, WRAP, FUNC)
|
||||
|
||||
|
||||
#define bOP(OP, COND, CHK, E) \
|
||||
static void Op##OP (void) { \
|
||||
pair newPC; \
|
||||
newPC.W = Relative(JUMP); \
|
||||
BranchCheck##CHK (); \
|
||||
if(COND){ \
|
||||
AddCycles(ONE_CYCLE); \
|
||||
if(E && Registers.PCh!=newPC.B.h){AddCycles(ONE_CYCLE);} \
|
||||
if((Registers.PCw&~MEMMAP_MASK)!=(newPC.W&~MEMMAP_MASK)){ \
|
||||
S9xSetPCBase(ICPU.ShiftedPB + newPC.W); \
|
||||
} else { \
|
||||
Registers.PCw = newPC.W; \
|
||||
} \
|
||||
CPUShutdown (); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
STATIC inline void SetZN (uint16 Work) {
|
||||
ICPU._Zero = Work != 0;
|
||||
ICPU._Negative = (uint8) (Work >> 8);
|
||||
}
|
||||
|
||||
STATIC inline void SetZN (uint8 Work) {
|
||||
ICPU._Zero = Work;
|
||||
ICPU._Negative = Work;
|
||||
}
|
||||
|
||||
STATIC inline void ADC (uint8 Work8) {
|
||||
if(CheckDecimal()) {
|
||||
uint8 A1 = Registers.A.W & 0x0F;
|
||||
uint16 A2 = Registers.A.W & 0xF0;
|
||||
uint8 W1 = Work8 & 0x0F;
|
||||
uint8 W2 = Work8 & 0xF0;
|
||||
|
||||
A1 += W1+CheckCarry();
|
||||
if(A1>0x09){
|
||||
A1-=0x0A;
|
||||
A1&=0x0F;
|
||||
A2+=0x10;
|
||||
}
|
||||
|
||||
A2 += W2;
|
||||
if(A2>0x90){
|
||||
A2-=0xA0;
|
||||
A2&=0xF0;
|
||||
SetCarry();
|
||||
} else {
|
||||
ClearCarry();
|
||||
}
|
||||
|
||||
uint8 Ans8 = A2|A1;
|
||||
if (~(Registers.AL ^ Work8) &
|
||||
(Work8 ^ Ans8) & 0x80)
|
||||
SetOverflow();
|
||||
else
|
||||
ClearOverflow();
|
||||
Registers.AL = Ans8;
|
||||
SetZN (Registers.AL);
|
||||
} else {
|
||||
uint16 Ans16 = Registers.AL + Work8 + CheckCarry();
|
||||
|
||||
ICPU._Carry = Ans16 >= 0x100;
|
||||
|
||||
if (~(Registers.AL ^ Work8) &
|
||||
(Work8 ^ (uint8) Ans16) & 0x80)
|
||||
SetOverflow();
|
||||
else
|
||||
ClearOverflow();
|
||||
Registers.AL = (uint8) Ans16;
|
||||
SetZN (Registers.AL);
|
||||
}
|
||||
}
|
||||
|
||||
STATIC inline void ADC (uint16 Work16) {
|
||||
if (CheckDecimal ()) {
|
||||
uint16 A1 = Registers.A.W & 0x000F;
|
||||
uint16 A2 = Registers.A.W & 0x00F0;
|
||||
uint16 A3 = Registers.A.W & 0x0F00;
|
||||
uint32 A4 = Registers.A.W & 0xF000;
|
||||
uint16 W1 = Work16 & 0x000F;
|
||||
uint16 W2 = Work16 & 0x00F0;
|
||||
uint16 W3 = Work16 & 0x0F00;
|
||||
uint16 W4 = Work16 & 0xF000;
|
||||
|
||||
A1 += W1 + CheckCarry ();
|
||||
if(A1>0x0009) {
|
||||
A1 -= 0x000A;
|
||||
A1 &= 0x000F;
|
||||
A2 += 0x0010;
|
||||
}
|
||||
|
||||
A2 += W2;
|
||||
if(A2>0x0090){
|
||||
A2 -= 0x00A0;
|
||||
A2 &= 0x00F0;
|
||||
A3 += 0x0100;
|
||||
}
|
||||
|
||||
A3 += W3;
|
||||
if(A3>0x0900){
|
||||
A3 -= 0x0A00;
|
||||
A3 &= 0x0F00;
|
||||
A4 += 0x1000;
|
||||
}
|
||||
|
||||
A4 += W4;
|
||||
if(A4>0x9000){
|
||||
A4 -= 0xA000;
|
||||
A4 &= 0xF000;
|
||||
SetCarry ();
|
||||
} else {
|
||||
ClearCarry ();
|
||||
}
|
||||
|
||||
uint16 Ans16 = A4|A3|A2|A1;
|
||||
if (~(Registers.A.W ^ Work16) &
|
||||
(Work16 ^ Ans16) & 0x8000)
|
||||
SetOverflow();
|
||||
else
|
||||
ClearOverflow();
|
||||
Registers.A.W = Ans16;
|
||||
SetZN (Registers.A.W);
|
||||
} else {
|
||||
uint32 Ans32 = Registers.A.W + Work16 + CheckCarry();
|
||||
|
||||
ICPU._Carry = Ans32 >= 0x10000;
|
||||
|
||||
if (~(Registers.A.W ^ Work16) &
|
||||
(Work16 ^ (uint16) Ans32) & 0x8000)
|
||||
SetOverflow();
|
||||
else
|
||||
ClearOverflow();
|
||||
Registers.A.W = (uint16) Ans32;
|
||||
SetZN (Registers.A.W);
|
||||
}
|
||||
}
|
||||
|
||||
STATIC inline void AND (uint16 Work16) {
|
||||
Registers.A.W &= Work16;
|
||||
SetZN (Registers.A.W);
|
||||
}
|
||||
|
||||
STATIC inline void AND (uint8 Work8) {
|
||||
Registers.AL &= Work8;
|
||||
SetZN (Registers.AL);
|
||||
}
|
||||
|
||||
STATIC inline void ASL16 (uint32 OpAddress, s9xwrap_t w) {
|
||||
uint16 Work16 = S9xGetWord (OpAddress, w);
|
||||
ICPU._Carry = (Work16 & 0x8000) != 0;
|
||||
Work16 <<= 1;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetWord (Work16, OpAddress, w, WRITE_10);
|
||||
OpenBus = (Work16&0xff);
|
||||
SetZN (Work16);
|
||||
}
|
||||
|
||||
STATIC inline void ASL8 (uint32 OpAddress) {
|
||||
uint8 Work8 = S9xGetByte (OpAddress);
|
||||
ICPU._Carry = (Work8 & 0x80) != 0;
|
||||
Work8 <<= 1;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetByte (Work8, OpAddress);
|
||||
OpenBus = Work8;
|
||||
SetZN (Work8);
|
||||
}
|
||||
|
||||
STATIC inline void BIT (uint16 Work16) {
|
||||
ICPU._Overflow = (Work16 & 0x4000) != 0;
|
||||
ICPU._Negative = (uint8) (Work16 >> 8);
|
||||
ICPU._Zero = (Work16 & Registers.A.W) != 0;
|
||||
}
|
||||
|
||||
STATIC inline void BIT (uint8 Work8) {
|
||||
ICPU._Overflow = (Work8 & 0x40) != 0;
|
||||
ICPU._Negative = Work8;
|
||||
ICPU._Zero = Work8 & Registers.AL;
|
||||
}
|
||||
|
||||
STATIC inline void CMP (uint16 val) {
|
||||
int32 Int32 = (int32) Registers.A.W - (int32) val;
|
||||
ICPU._Carry = Int32 >= 0;
|
||||
SetZN ((uint16) Int32);
|
||||
}
|
||||
|
||||
STATIC inline void CMP (uint8 val) {
|
||||
int16 Int16 = (int16) Registers.AL - (int16) val;
|
||||
ICPU._Carry = Int16 >= 0;
|
||||
SetZN ((uint8) Int16);
|
||||
}
|
||||
|
||||
STATIC inline void CPX (uint16 val) {
|
||||
int32 Int32 = (int32) Registers.X.W - (int32) val;
|
||||
ICPU._Carry = Int32 >= 0;
|
||||
SetZN ((uint16) Int32);
|
||||
}
|
||||
|
||||
STATIC inline void CPX (uint8 val) {
|
||||
int16 Int16 = (int16) Registers.XL - (int16) val;
|
||||
ICPU._Carry = Int16 >= 0;
|
||||
SetZN ((uint8) Int16);
|
||||
}
|
||||
|
||||
STATIC inline void CPY (uint16 val) {
|
||||
int32 Int32 = (int32) Registers.Y.W - (int32) val;
|
||||
ICPU._Carry = Int32 >= 0;
|
||||
SetZN ((uint16) Int32);
|
||||
}
|
||||
|
||||
STATIC inline void CPY (uint8 val) {
|
||||
int16 Int16 = (int16) Registers.YL - (int16) val;
|
||||
ICPU._Carry = Int16 >= 0;
|
||||
SetZN ((uint8) Int16);
|
||||
}
|
||||
|
||||
STATIC inline void DEC16 (uint32 OpAddress, s9xwrap_t w) {
|
||||
#ifdef CPU_SHUTDOWN
|
||||
CPU.WaitAddress = 0xffffffff;
|
||||
#endif
|
||||
|
||||
uint16 Work16 = S9xGetWord(OpAddress, w) - 1;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetWord (Work16, OpAddress, w, WRITE_10);
|
||||
OpenBus = Work16&0xff;
|
||||
SetZN (Work16);
|
||||
}
|
||||
|
||||
STATIC inline void DEC8 (uint32 OpAddress) {
|
||||
#ifdef CPU_SHUTDOWN
|
||||
CPU.WaitAddress = 0xffffffff;
|
||||
#endif
|
||||
|
||||
uint8 Work8 = S9xGetByte (OpAddress) - 1;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetByte (Work8, OpAddress);
|
||||
OpenBus = Work8;
|
||||
SetZN (Work8);
|
||||
}
|
||||
|
||||
STATIC inline void EOR (uint16 val) {
|
||||
Registers.A.W ^= val;
|
||||
SetZN (Registers.A.W);
|
||||
}
|
||||
|
||||
STATIC inline void EOR (uint8 val) {
|
||||
Registers.AL ^= val;
|
||||
SetZN (Registers.AL);
|
||||
}
|
||||
|
||||
STATIC inline void INC16 (uint32 OpAddress, s9xwrap_t w) {
|
||||
#ifdef CPU_SHUTDOWN
|
||||
CPU.WaitAddress = 0xffffffff;
|
||||
#endif
|
||||
|
||||
uint16 Work16 = S9xGetWord(OpAddress, w) + 1;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetWord (Work16, OpAddress, w, WRITE_10);
|
||||
OpenBus = Work16&0xff;
|
||||
SetZN (Work16);
|
||||
}
|
||||
|
||||
STATIC inline void INC8 (uint32 OpAddress) {
|
||||
#ifdef CPU_SHUTDOWN
|
||||
CPU.WaitAddress = 0xffffffff;
|
||||
#endif
|
||||
|
||||
uint8 Work8 = S9xGetByte (OpAddress) + 1;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetByte (Work8, OpAddress);
|
||||
OpenBus = Work8;
|
||||
SetZN (Work8);
|
||||
}
|
||||
|
||||
STATIC inline void LDA (uint16 val) {
|
||||
Registers.A.W = val;
|
||||
SetZN (Registers.A.W);
|
||||
}
|
||||
|
||||
STATIC inline void LDA (uint8 val) {
|
||||
Registers.AL = val;
|
||||
SetZN (Registers.AL);
|
||||
}
|
||||
|
||||
STATIC inline void LDX (uint16 val) {
|
||||
Registers.X.W = val;
|
||||
SetZN (Registers.X.W);
|
||||
}
|
||||
|
||||
STATIC inline void LDX (uint8 val) {
|
||||
Registers.XL = val;
|
||||
SetZN (Registers.XL);
|
||||
}
|
||||
|
||||
STATIC inline void LDY (uint16 val) {
|
||||
Registers.Y.W = val;
|
||||
SetZN (Registers.Y.W);
|
||||
}
|
||||
|
||||
STATIC inline void LDY (uint8 val) {
|
||||
Registers.YL = val;
|
||||
SetZN (Registers.YL);
|
||||
}
|
||||
|
||||
STATIC inline void LSR16 (uint32 OpAddress, s9xwrap_t w) {
|
||||
uint16 Work16 = S9xGetWord (OpAddress, w);
|
||||
ICPU._Carry = Work16 & 1;
|
||||
Work16 >>= 1;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetWord (Work16, OpAddress, w, WRITE_10);
|
||||
OpenBus = (Work16&0xff);
|
||||
SetZN (Work16);
|
||||
}
|
||||
|
||||
STATIC inline void LSR8 (uint32 OpAddress) {
|
||||
uint8 Work8 = S9xGetByte (OpAddress);
|
||||
ICPU._Carry = Work8 & 1;
|
||||
Work8 >>= 1;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetByte (Work8, OpAddress);
|
||||
OpenBus = Work8;
|
||||
SetZN (Work8);
|
||||
}
|
||||
|
||||
STATIC inline void ORA (uint16 val) {
|
||||
Registers.A.W |= val;
|
||||
SetZN (Registers.A.W);
|
||||
}
|
||||
|
||||
STATIC inline void ORA (uint8 val) {
|
||||
Registers.AL |= val;
|
||||
SetZN (Registers.AL);
|
||||
}
|
||||
|
||||
STATIC inline void ROL16 (uint32 OpAddress, s9xwrap_t w) {
|
||||
uint32 Work32 = (((uint32)S9xGetWord(OpAddress, w))<<1) | CheckCarry();
|
||||
ICPU._Carry = Work32>=0x10000;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetWord ((uint16)Work32, OpAddress, w, WRITE_10);
|
||||
OpenBus = (Work32&0xff);
|
||||
SetZN ((uint16)Work32);
|
||||
}
|
||||
|
||||
STATIC inline void ROL8 (uint32 OpAddress) {
|
||||
uint16 Work16 = (((uint16)S9xGetByte(OpAddress))<<1) | CheckCarry();
|
||||
ICPU._Carry = Work16>=0x100;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetByte ((uint8)Work16, OpAddress);
|
||||
OpenBus = Work16&0xff;
|
||||
SetZN ((uint8)Work16);
|
||||
}
|
||||
|
||||
STATIC inline void ROR16 (uint32 OpAddress, s9xwrap_t w) {
|
||||
uint32 Work32 = ((uint32)S9xGetWord(OpAddress, w)) | (((uint32)CheckCarry())<<16);
|
||||
ICPU._Carry = Work32&1;
|
||||
Work32 >>= 1;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetWord ((uint16)Work32, OpAddress, w, WRITE_10);
|
||||
OpenBus = (Work32&0xff);
|
||||
SetZN ((uint16)Work32);
|
||||
}
|
||||
|
||||
STATIC inline void ROR8 (uint32 OpAddress) {
|
||||
uint16 Work16 = ((uint16)S9xGetByte(OpAddress)) | (((uint16)CheckCarry())<<8);
|
||||
ICPU._Carry = Work16&1;
|
||||
Work16 >>= 1;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetByte ((uint8)Work16, OpAddress);
|
||||
OpenBus = Work16&0xff;
|
||||
SetZN ((uint8)Work16);
|
||||
}
|
||||
|
||||
STATIC inline void SBC (uint16 Work16) {
|
||||
if (CheckDecimal ()) {
|
||||
uint16 A1 = Registers.A.W & 0x000F;
|
||||
uint16 A2 = Registers.A.W & 0x00F0;
|
||||
uint16 A3 = Registers.A.W & 0x0F00;
|
||||
uint32 A4 = Registers.A.W & 0xF000;
|
||||
uint16 W1 = Work16 & 0x000F;
|
||||
uint16 W2 = Work16 & 0x00F0;
|
||||
uint16 W3 = Work16 & 0x0F00;
|
||||
uint16 W4 = Work16 & 0xF000;
|
||||
|
||||
A1 -= W1 + !CheckCarry ();
|
||||
A2 -= W2;
|
||||
A3 -= W3;
|
||||
A4 -= W4;
|
||||
if (A1 > 0x000F) {
|
||||
A1 += 0x000A;
|
||||
A1 &= 0x000F;
|
||||
A2 -= 0x0010;
|
||||
}
|
||||
if (A2 > 0x00F0) {
|
||||
A2 += 0x00A0;
|
||||
A2 &= 0x00F0;
|
||||
A3 -= 0x0100;
|
||||
}
|
||||
if (A3 > 0x0F00) {
|
||||
A3 += 0x0A00;
|
||||
A3 &= 0x0F00;
|
||||
A4 -= 0x1000;
|
||||
}
|
||||
if (A4 > 0xF000) {
|
||||
A4 += 0xA000;
|
||||
A4 &= 0xF000;
|
||||
ClearCarry ();
|
||||
} else {
|
||||
SetCarry ();
|
||||
}
|
||||
|
||||
uint16 Ans16 = A4|A3|A2|A1;
|
||||
if ((Registers.A.W ^ Work16) &
|
||||
(Registers.A.W ^ Ans16) & 0x8000)
|
||||
SetOverflow();
|
||||
else
|
||||
ClearOverflow();
|
||||
Registers.A.W = Ans16;
|
||||
SetZN (Registers.A.W);
|
||||
} else {
|
||||
int32 Int32 = (int32) Registers.A.W - (int32) Work16 + (int32) CheckCarry() - 1;
|
||||
|
||||
ICPU._Carry = Int32 >= 0;
|
||||
|
||||
if ((Registers.A.W ^ Work16) &
|
||||
(Registers.A.W ^ (uint16) Int32) & 0x8000)
|
||||
SetOverflow();
|
||||
else
|
||||
ClearOverflow ();
|
||||
Registers.A.W = (uint16) Int32;
|
||||
SetZN (Registers.A.W);
|
||||
}
|
||||
}
|
||||
|
||||
STATIC inline void SBC (uint8 Work8) {
|
||||
if (CheckDecimal ()) {
|
||||
uint8 A1 = Registers.A.W & 0x0F;
|
||||
uint16 A2 = Registers.A.W & 0xF0;
|
||||
uint8 W1 = Work8 & 0x0F;
|
||||
uint8 W2 = Work8 & 0xF0;
|
||||
|
||||
A1 -= W1 + !CheckCarry ();
|
||||
A2 -= W2;
|
||||
if (A1 > 0x0F) {
|
||||
A1 += 0x0A;
|
||||
A1 &= 0x0F;
|
||||
A2 -= 0x10;
|
||||
}
|
||||
if (A2 > 0xF0) {
|
||||
A2 += 0xA0;
|
||||
A2 &= 0xF0;
|
||||
ClearCarry ();
|
||||
} else {
|
||||
SetCarry ();
|
||||
}
|
||||
|
||||
uint8 Ans8 = A2|A1;
|
||||
if ((Registers.AL ^ Work8) &
|
||||
(Registers.AL ^ Ans8) & 0x80)
|
||||
SetOverflow ();
|
||||
else
|
||||
ClearOverflow ();
|
||||
Registers.AL = Ans8;
|
||||
SetZN (Registers.AL);
|
||||
} else {
|
||||
int16 Int16 = (int16) Registers.AL - (int16) Work8 + (int16) CheckCarry() - 1;
|
||||
|
||||
ICPU._Carry = Int16 >= 0;
|
||||
if ((Registers.AL ^ Work8) &
|
||||
(Registers.AL ^ (uint8) Int16) & 0x80)
|
||||
SetOverflow ();
|
||||
else
|
||||
ClearOverflow ();
|
||||
Registers.AL = (uint8) Int16;
|
||||
SetZN (Registers.AL);
|
||||
}
|
||||
}
|
||||
|
||||
STATIC inline void STA16 (uint32 OpAddress, enum s9xwrap_t w) {
|
||||
S9xSetWord (Registers.A.W, OpAddress, w);
|
||||
OpenBus = Registers.AH;
|
||||
}
|
||||
|
||||
STATIC inline void STA8 (uint32 OpAddress) {
|
||||
S9xSetByte (Registers.AL, OpAddress);
|
||||
OpenBus = Registers.AL;
|
||||
}
|
||||
|
||||
STATIC inline void STX16 (uint32 OpAddress, enum s9xwrap_t w) {
|
||||
S9xSetWord (Registers.X.W, OpAddress, w);
|
||||
OpenBus = Registers.XH;
|
||||
}
|
||||
|
||||
STATIC inline void STX8 (uint32 OpAddress) {
|
||||
S9xSetByte (Registers.XL, OpAddress);
|
||||
OpenBus = Registers.XL;
|
||||
}
|
||||
|
||||
STATIC inline void STY16 (uint32 OpAddress, enum s9xwrap_t w) {
|
||||
S9xSetWord (Registers.Y.W, OpAddress, w);
|
||||
OpenBus = Registers.YH;
|
||||
}
|
||||
|
||||
STATIC inline void STY8 (uint32 OpAddress) {
|
||||
S9xSetByte (Registers.YL, OpAddress);
|
||||
OpenBus = Registers.YL;
|
||||
}
|
||||
|
||||
STATIC inline void STZ16 (uint32 OpAddress, enum s9xwrap_t w) {
|
||||
S9xSetWord (0, OpAddress, w);
|
||||
OpenBus = 0;
|
||||
}
|
||||
|
||||
STATIC inline void STZ8 (uint32 OpAddress) {
|
||||
S9xSetByte (0, OpAddress);
|
||||
OpenBus = 0;
|
||||
}
|
||||
|
||||
STATIC inline void TSB16 (uint32 OpAddress, enum s9xwrap_t w) {
|
||||
uint16 Work16 = S9xGetWord (OpAddress, w);
|
||||
ICPU._Zero = (Work16 & Registers.A.W) != 0;
|
||||
Work16 |= Registers.A.W;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetWord (Work16, OpAddress, w, WRITE_10);
|
||||
OpenBus = Work16&0xff;
|
||||
}
|
||||
|
||||
STATIC inline void TSB8 (uint32 OpAddress) {
|
||||
uint8 Work8 = S9xGetByte (OpAddress);
|
||||
ICPU._Zero = Work8 & Registers.AL;
|
||||
Work8 |= Registers.AL;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetByte (Work8, OpAddress);
|
||||
OpenBus = Work8;
|
||||
}
|
||||
|
||||
STATIC inline void TRB16 (uint32 OpAddress, enum s9xwrap_t w) {
|
||||
uint16 Work16 = S9xGetWord (OpAddress, w);
|
||||
ICPU._Zero = (Work16 & Registers.A.W) != 0;
|
||||
Work16 &= ~Registers.A.W;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetWord (Work16, OpAddress, w, WRITE_10);
|
||||
OpenBus = Work16&0xff;
|
||||
}
|
||||
|
||||
STATIC inline void TRB8 (uint32 OpAddress) {
|
||||
uint8 Work8 = S9xGetByte (OpAddress);
|
||||
ICPU._Zero = Work8 & Registers.AL;
|
||||
Work8 &= ~Registers.AL;
|
||||
AddCycles(ONE_CYCLE);
|
||||
S9xSetByte (Work8, OpAddress);
|
||||
OpenBus = Work8;
|
||||
}
|
||||
#endif
|
3639
source/snes9x/cpuops.cpp
Normal file
3639
source/snes9x/cpuops.cpp
Normal file
File diff suppressed because it is too large
Load Diff
155
source/snes9x/cpuops.h
Normal file
155
source/snes9x/cpuops.h
Normal file
@ -0,0 +1,155 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _CPUOPS_H_
|
||||
#define _CPUOPS_H_
|
||||
void S9xOpcode_NMI ();
|
||||
void S9xOpcode_IRQ ();
|
||||
|
||||
#define CHECK_FOR_IRQ() \
|
||||
if (CPU.IRQActive && !CheckFlag (IRQ) && !Settings.DisableIRQ) \
|
||||
S9xOpcode_IRQ()
|
||||
|
||||
#endif
|
||||
|
626
source/snes9x/crosshairs.cpp
Normal file
626
source/snes9x/crosshairs.cpp
Normal file
@ -0,0 +1,626 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_LIBPNG
|
||||
#include <png.h>
|
||||
#endif
|
||||
|
||||
#include "port.h"
|
||||
#include "crosshairs.h"
|
||||
|
||||
static char *crosshairs[32]={
|
||||
"` " /* Crosshair 0 (no image) */
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" ",
|
||||
|
||||
"` " /* Crosshair 1 (the classic small dot) */
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" #. "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" ",
|
||||
|
||||
"` " /* Crosshair 2 (a standard cross) */
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" ...#... "
|
||||
" ####### "
|
||||
" ...#... "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" ",
|
||||
|
||||
"` .#. " /* Crosshair 3 (a standard cross) */
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. "
|
||||
".......#......."
|
||||
"###############"
|
||||
".......#......."
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. ",
|
||||
|
||||
"` " /* Crosshair 4 (an X) */
|
||||
" "
|
||||
" "
|
||||
" . . "
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
" .#.#. "
|
||||
" .#. "
|
||||
" .#.#. "
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
" . . "
|
||||
" "
|
||||
" "
|
||||
" ",
|
||||
|
||||
"`. . " /* Crosshair 5 (an X) */
|
||||
".#. .#."
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
" .#.#. "
|
||||
" .#. "
|
||||
" .#.#. "
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
".#. .#."
|
||||
" . . ",
|
||||
|
||||
"` " /* Crosshair 6 (a combo) */
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" #.# "
|
||||
" ...#... "
|
||||
" #.# "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" ",
|
||||
|
||||
"` . " /* Crosshair 7 (a combo) */
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" #.# "
|
||||
".......#......."
|
||||
" #.# "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" . ",
|
||||
|
||||
"` # " /* Crosshair 8 (a diamond cross) */
|
||||
" #.# "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
"#......#......#"
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" #.# "
|
||||
" # ",
|
||||
|
||||
"` ### " /* Crosshair 9 (a circle cross) */
|
||||
" ## . ## "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
"# . #"
|
||||
"#......#......#"
|
||||
"# . #"
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" ## . ## "
|
||||
" ### ",
|
||||
|
||||
"` .#. " /* Crosshair 10 (a square cross) */
|
||||
" .#. "
|
||||
" .#. "
|
||||
" ....#.... "
|
||||
" .#######. "
|
||||
" .# #. "
|
||||
"....# #...."
|
||||
"##### #####"
|
||||
"....# #...."
|
||||
" .# #. "
|
||||
" .#######. "
|
||||
" ....#.... "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. ",
|
||||
|
||||
"` .#. " /* Crosshair 11 (an interrupted cross) */
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" "
|
||||
"..... ....."
|
||||
"##### #####"
|
||||
"..... ....."
|
||||
" "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. "
|
||||
" .#. ",
|
||||
|
||||
"`. . " /* Crosshair 12 (an interrupted X) */
|
||||
".#. .#."
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
" .#. .#. "
|
||||
".#. .#."
|
||||
" . . ",
|
||||
|
||||
"` . " /* Crosshair 13 (an interrupted combo) */
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" "
|
||||
" "
|
||||
"..... ....."
|
||||
" "
|
||||
" "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" # . # "
|
||||
" . ",
|
||||
|
||||
"`#### #### " /* Crosshair 14 */
|
||||
"#.... ....#"
|
||||
"#. .#"
|
||||
"#. .#"
|
||||
"#. .#"
|
||||
" # "
|
||||
" # "
|
||||
" ##### "
|
||||
" # "
|
||||
" # "
|
||||
"#. .#"
|
||||
"#. .#"
|
||||
"#. .#"
|
||||
"#.... ....#"
|
||||
" #### #### ",
|
||||
|
||||
"` .# #. " /* Crosshair 15 */
|
||||
" .# #. "
|
||||
" .# #. "
|
||||
"....# #...."
|
||||
"##### #####"
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
"##### #####"
|
||||
"....# #...."
|
||||
" .# #. "
|
||||
" .# #. "
|
||||
" .# #. ",
|
||||
|
||||
"` # " /* Crosshair 16 */
|
||||
" # "
|
||||
" # "
|
||||
" ....#.... "
|
||||
" . # . "
|
||||
" . # . "
|
||||
" . # . "
|
||||
"###############"
|
||||
" . # . "
|
||||
" . # . "
|
||||
" . # . "
|
||||
" ....#.... "
|
||||
" # "
|
||||
" # "
|
||||
" # ",
|
||||
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL
|
||||
};
|
||||
|
||||
bool S9xLoadCrosshairFile(int idx, const char *filename){
|
||||
int i, r;
|
||||
char *s;
|
||||
FILE *fp;
|
||||
|
||||
if(idx<1 || idx>31) return false;
|
||||
if((s=(char *)calloc(15*15+1, sizeof(char)))==NULL){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: malloc error while reading ");
|
||||
perror(filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
if((fp=fopen(filename, "rb"))==NULL){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: Couldn't open ");
|
||||
perror(filename);
|
||||
free(s);
|
||||
return false;
|
||||
}
|
||||
|
||||
i=fread(s, 1, 8, fp);
|
||||
if(i!=8){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: File is too short!\n");
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
#ifdef HAVE_LIBPNG
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
|
||||
if(!png_sig_cmp((png_byte *)s, 0, 8)){
|
||||
png_ptr=png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (!png_ptr){
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
info_ptr=png_create_info_struct(png_ptr);
|
||||
if(!info_ptr){
|
||||
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
png_set_sig_bytes(png_ptr, 8);
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
png_uint_32 width, height;
|
||||
int bit_depth, color_type;
|
||||
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, NULL, NULL, NULL);
|
||||
if(color_type!=PNG_COLOR_TYPE_PALETTE){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: Input PNG is not a palettized image!\n");
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
if(bit_depth==16)
|
||||
png_set_strip_16(png_ptr);
|
||||
|
||||
if(width!=15 || height!=15){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: Expecting a 15x15 PNG\n");
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
int num_palette=0, num_trans=0;
|
||||
int fgcol=-1, bgcol=-1, transcol=-1;
|
||||
png_color *pngpal;
|
||||
png_byte *trans;
|
||||
|
||||
png_get_PLTE(png_ptr, info_ptr, &pngpal, &num_palette);
|
||||
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL);
|
||||
|
||||
if(num_palette!=3 || num_trans!=1){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: Expecting a 3-color PNG with 1 trasnparent color\n");
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
for(i=0; i<3; i++){
|
||||
if(trans[0]==i){
|
||||
transcol=i;
|
||||
} else if(pngpal[i].red==0 && pngpal[i].green==0 && pngpal[i].blue==0){
|
||||
bgcol=i;
|
||||
} else if(pngpal[i].red==255 && pngpal[i].green==255 && pngpal[i].blue==255){
|
||||
fgcol=i;
|
||||
}
|
||||
}
|
||||
|
||||
if(transcol<0 || fgcol<0 || bgcol<0){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: PNG must have 3 colors: white (fg), black (bg), and transparent.\n");
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
png_set_packing(png_ptr);
|
||||
png_read_update_info(png_ptr, info_ptr);
|
||||
png_byte *row_pointer = new png_byte [png_get_rowbytes(png_ptr, info_ptr)];
|
||||
|
||||
for(r=0; r<15*15; r+=15){
|
||||
png_read_row(png_ptr, row_pointer, NULL);
|
||||
for(i=0; i<15; i++){
|
||||
if(row_pointer[i]==transcol) s[r+i]=' ';
|
||||
else if(row_pointer[i]==fgcol) s[r+i]='#';
|
||||
else if(row_pointer[i]==bgcol) s[r+i]='.';
|
||||
else {
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: WTF? This was supposed to be a 3-color PNG!\n");
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
s[15*15]=0;
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
i=fread(s+8, 1, 15-8, fp);
|
||||
if(i!=15-8){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: File is too short!\n");
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
if(getc(fp)!='\n'){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: Invalid file format!");
|
||||
#ifndef HAVE_LIBPNG
|
||||
fprintf(stderr, " (note: PNG support is not available)");
|
||||
#endif
|
||||
fprintf(stderr, "\n");
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
for(r=1; r<15; r++){
|
||||
i=fread(s+r*15, 1, 15, fp);
|
||||
if(i!=15){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: File is too short!");
|
||||
#ifndef HAVE_LIBPNG
|
||||
fprintf(stderr, " (note: PNG support is not available)");
|
||||
#endif
|
||||
fprintf(stderr, "\n");
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
if(getc(fp)!='\n'){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: Invalid file format!");
|
||||
#ifndef HAVE_LIBPNG
|
||||
fprintf(stderr, " (note: PNG support is not available)");
|
||||
#endif
|
||||
fprintf(stderr, "\n");
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for(i=0; i<15*15; i++){
|
||||
if(s[i]!=' ' && s[i]!='#' && s[i]!='.'){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: Invalid file format!");
|
||||
#ifndef HAVE_LIBPNG
|
||||
fprintf(stderr, " (note: PNG support is not available)");
|
||||
#endif
|
||||
fprintf(stderr, "\n");
|
||||
free(s);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
if(crosshairs[idx]!=NULL && crosshairs[idx][0]!='`') free(crosshairs[idx]);
|
||||
crosshairs[idx]=s;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *S9xGetCrosshair(int idx){
|
||||
if(idx<0 || idx>31) return NULL;
|
||||
return crosshairs[idx];
|
||||
}
|
201
source/snes9x/crosshairs.h
Normal file
201
source/snes9x/crosshairs.h
Normal file
@ -0,0 +1,201 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifndef CROSSHAIRS_H
|
||||
#define CROSSHAIRS_H
|
||||
|
||||
/*
|
||||
* Read in the specified crosshair file, replacing whatever data might be in
|
||||
* that slot. Available slots are 1-31. The input file must be a PNG file,
|
||||
* 15x15 pixels, palettized, with 3 colors: white, black, and transparent. Or a
|
||||
* text file, 15 lines of 16 characters (counting the \n), consisting of ' ',
|
||||
* '#', or '.'.
|
||||
*/
|
||||
bool S9xLoadCrosshairFile(int idx, const char *filename);
|
||||
|
||||
/*
|
||||
* Return the specified crosshair. Woo-hoo. char * to a 225-byte string, with
|
||||
* '#' marking foreground, '.' marking background, and anything else
|
||||
* transparent.
|
||||
*/
|
||||
const char *S9xGetCrosshair(int idx);
|
||||
|
||||
/*
|
||||
* In controls.cpp. Sets the crosshair for the specified device. Defaults are:
|
||||
* cross fgcolor bgcolor
|
||||
* Mouse 1: 1 White Black
|
||||
* Mouse 2: 1 Purple White
|
||||
* Superscope: 2 White Black
|
||||
* Justifier 1: 4 Blue Black
|
||||
* Justifier 2: 4 MagicPink Black
|
||||
*
|
||||
* Available colors are: Trans, Black, 25Grey, 50Grey, 75Grey, White, Red,
|
||||
* Orange, Yellow, Green, Cyan, Sky, Blue, Violet, MagicPink, and Purple. You
|
||||
* may also prefix a 't' (e.g. tBlue) for a 50%-transparent version.
|
||||
*
|
||||
* Use idx=-1 or fg/bg=NULL to keep the current setting.
|
||||
*/
|
||||
enum crosscontrols {
|
||||
X_MOUSE1,
|
||||
X_MOUSE2,
|
||||
X_SUPERSCOPE,
|
||||
X_JUSTIFIER1,
|
||||
X_JUSTIFIER2
|
||||
};
|
||||
void S9xSetControllerCrosshair(enum crosscontrols ctl, int8 idx, const char *fg, const char *bg);
|
||||
void S9xGetControllerCrosshair(enum crosscontrols ctl, int8 *idx, const char **fg, const char **bg);
|
||||
|
||||
/*
|
||||
* In gfx.cpp, much like DisplayChar() except it takes the parameters listed
|
||||
* and looks up GFX.Screen. The 'crosshair' arg is a 15x15 image, with '#'
|
||||
* meaning fgcolor, '.' meaning bgcolor, and anything else meaning transparent.
|
||||
* Color values should be (RGB):
|
||||
* 0 = transparent 4=23 23 23 8=31 31 0 12= 0 0 31
|
||||
* 1 = 0 0 0 5=31 31 31 9= 0 31 0 13=23 0 31
|
||||
* 2 = 8 8 8 6=31 00 00 10= 0 31 31 14=31 0 31
|
||||
* 3 = 16 16 16 7=31 16 00 11= 0 23 31 15=31 0 16
|
||||
* 16-31 are 50% transparent versions of 0-15.
|
||||
*/
|
||||
void S9xDrawCrosshair(const char *crosshair, uint8 fgcolor, uint8 bgcolor, int16 x, int16 y);
|
||||
|
||||
#endif
|
594
source/snes9x/data.cpp
Normal file
594
source/snes9x/data.cpp
Normal file
@ -0,0 +1,594 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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 "snes9x.h"
|
||||
|
||||
uint8 add32_32 [32][32] = {
|
||||
{ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,
|
||||
0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,
|
||||
0x1e,0x1f},
|
||||
{ 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
|
||||
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,
|
||||
0x1f,0x1f},
|
||||
{ 0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,
|
||||
0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,
|
||||
0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,
|
||||
0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,
|
||||
0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,
|
||||
0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,
|
||||
0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,
|
||||
0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
|
||||
0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,
|
||||
0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,
|
||||
0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,
|
||||
0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,
|
||||
0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,
|
||||
0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,
|
||||
0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f},
|
||||
{ 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,
|
||||
0x1f,0x1f}
|
||||
};
|
||||
|
||||
uint8 add32_32_half [32][32] = {
|
||||
{ 0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,
|
||||
0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,
|
||||
0x0f,0x0f},
|
||||
{ 0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,
|
||||
0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,
|
||||
0x0f,0x10},
|
||||
{ 0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,
|
||||
0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,
|
||||
0x10,0x10},
|
||||
{ 0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,
|
||||
0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,
|
||||
0x10,0x11},
|
||||
{ 0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,
|
||||
0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,
|
||||
0x11,0x11},
|
||||
{ 0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,
|
||||
0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,
|
||||
0x11,0x12},
|
||||
{ 0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,
|
||||
0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,
|
||||
0x12,0x12},
|
||||
{ 0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,
|
||||
0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,
|
||||
0x12,0x13},
|
||||
{ 0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,
|
||||
0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,
|
||||
0x13,0x13},
|
||||
{ 0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,
|
||||
0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,
|
||||
0x13,0x14},
|
||||
{ 0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,
|
||||
0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,
|
||||
0x14,0x14},
|
||||
{ 0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,
|
||||
0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,
|
||||
0x14,0x15},
|
||||
{ 0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,
|
||||
0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,
|
||||
0x15,0x15},
|
||||
{ 0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,
|
||||
0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,
|
||||
0x15,0x16},
|
||||
{ 0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,
|
||||
0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,
|
||||
0x16,0x16},
|
||||
{ 0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,
|
||||
0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,
|
||||
0x16,0x17},
|
||||
{ 0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,
|
||||
0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,
|
||||
0x17,0x17},
|
||||
{ 0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,
|
||||
0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,0x17,
|
||||
0x17,0x18},
|
||||
{ 0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,
|
||||
0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,0x17,0x17,
|
||||
0x18,0x18},
|
||||
{ 0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,
|
||||
0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,0x17,0x17,0x18,
|
||||
0x18,0x19},
|
||||
{ 0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,
|
||||
0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,
|
||||
0x19,0x19},
|
||||
{ 0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,
|
||||
0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x19,
|
||||
0x19,0x1a},
|
||||
{ 0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,
|
||||
0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x19,0x19,
|
||||
0x1a,0x1a},
|
||||
{ 0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,
|
||||
0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x19,0x19,0x1a,
|
||||
0x1a,0x1b},
|
||||
{ 0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,
|
||||
0x13,0x14,0x14,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x19,0x19,0x1a,0x1a,
|
||||
0x1b,0x1b},
|
||||
{ 0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,
|
||||
0x14,0x14,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x19,0x19,0x1a,0x1a,0x1b,
|
||||
0x1b,0x1c},
|
||||
{ 0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,
|
||||
0x14,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x19,0x19,0x1a,0x1a,0x1b,0x1b,
|
||||
0x1c,0x1c},
|
||||
{ 0x0d,0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,
|
||||
0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1c,
|
||||
0x1c,0x1d},
|
||||
{ 0x0e,0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,
|
||||
0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,
|
||||
0x1d,0x1d},
|
||||
{ 0x0e,0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,
|
||||
0x16,0x16,0x17,0x17,0x18,0x18,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1d,
|
||||
0x1d,0x1e},
|
||||
{ 0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,
|
||||
0x16,0x17,0x17,0x18,0x18,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,
|
||||
0x1e,0x1e},
|
||||
{ 0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,
|
||||
0x17,0x17,0x18,0x18,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1e,
|
||||
0x1e,0x1f}
|
||||
};
|
||||
uint8 sub32_32 [32][32] = {
|
||||
{ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,
|
||||
0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,
|
||||
0x1e,0x1f},
|
||||
{ 0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,
|
||||
0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,
|
||||
0x1d,0x1e},
|
||||
{ 0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,
|
||||
0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,
|
||||
0x1c,0x1d},
|
||||
{ 0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,
|
||||
0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,
|
||||
0x1b,0x1c},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,
|
||||
0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,
|
||||
0x1a,0x1b},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
|
||||
0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,
|
||||
0x19,0x1a},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
|
||||
0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
|
||||
0x18,0x19},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
|
||||
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,
|
||||
0x17,0x18},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,
|
||||
0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,
|
||||
0x16,0x17},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,
|
||||
0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,
|
||||
0x15,0x16},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,
|
||||
0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,
|
||||
0x14,0x15},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,
|
||||
0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,
|
||||
0x13,0x14},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,
|
||||
0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,
|
||||
0x12,0x13},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
|
||||
0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,
|
||||
0x11,0x12},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
|
||||
0x10,0x11},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,
|
||||
0x0f,0x10},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,
|
||||
0x0e,0x0f},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,
|
||||
0x0d,0x0e},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,
|
||||
0x0c,0x0d},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,
|
||||
0x0b,0x0c},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
|
||||
0x0a,0x0b},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
|
||||
0x09,0x0a},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
|
||||
0x08,0x09},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,
|
||||
0x07,0x08},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,
|
||||
0x06,0x07},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,
|
||||
0x05,0x06},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,
|
||||
0x04,0x05},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,
|
||||
0x03,0x04},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
|
||||
0x02,0x03},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x01,0x02},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x01},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00}
|
||||
};
|
||||
|
||||
uint8 sub32_32_half [32][32] = {
|
||||
{ 0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,
|
||||
0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,
|
||||
0x0f,0x0f},
|
||||
{ 0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,
|
||||
0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,
|
||||
0x0e,0x0f},
|
||||
{ 0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,
|
||||
0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,
|
||||
0x0e,0x0e},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,
|
||||
0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,
|
||||
0x0d,0x0e},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,
|
||||
0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,
|
||||
0x0d,0x0d},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,
|
||||
0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,
|
||||
0x0c,0x0d},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,
|
||||
0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,
|
||||
0x0c,0x0c},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,
|
||||
0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,
|
||||
0x0b,0x0c},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,
|
||||
0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,
|
||||
0x0b,0x0b},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,
|
||||
0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,0x0a,
|
||||
0x0a,0x0b},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,
|
||||
0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,0x09,
|
||||
0x0a,0x0a},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
|
||||
0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,0x09,
|
||||
0x09,0x0a},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
|
||||
0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08,
|
||||
0x09,0x09},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,
|
||||
0x08,0x09},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,
|
||||
0x08,0x08},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,
|
||||
0x07,0x08},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,
|
||||
0x07,0x07},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,
|
||||
0x06,0x07},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,
|
||||
0x06,0x06},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,
|
||||
0x05,0x06},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,
|
||||
0x05,0x05},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,
|
||||
0x04,0x05},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,
|
||||
0x04,0x04},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,
|
||||
0x03,0x04},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,
|
||||
0x03,0x03},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,
|
||||
0x02,0x03},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
|
||||
0x02,0x02},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
|
||||
0x01,0x02},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x01,0x01},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x01},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00}
|
||||
};
|
||||
|
||||
|
||||
uint8 mul_brightness [16][32] = {
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00},
|
||||
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
||||
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
|
||||
0x02,0x02},
|
||||
{ 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,
|
||||
0x02,0x02,0x02,0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x04,0x04,0x04,
|
||||
0x04,0x04},
|
||||
{ 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x03,0x03,
|
||||
0x03,0x03,0x03,0x04,0x04,0x04,0x04,0x04,0x05,0x05,0x05,0x05,0x05,0x06,0x06,
|
||||
0x06,0x06},
|
||||
{ 0x00,0x00,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x03,0x03,0x03,0x03,0x04,
|
||||
0x04,0x04,0x05,0x05,0x05,0x05,0x06,0x06,0x06,0x06,0x07,0x07,0x07,0x07,0x08,
|
||||
0x08,0x08},
|
||||
{ 0x00,0x00,0x01,0x01,0x01,0x02,0x02,0x02,0x03,0x03,0x03,0x04,0x04,0x04,0x05,
|
||||
0x05,0x05,0x06,0x06,0x06,0x07,0x07,0x07,0x08,0x08,0x08,0x09,0x09,0x09,0x0a,
|
||||
0x0a,0x0a},
|
||||
{ 0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x03,0x03,0x04,0x04,0x04,0x05,0x05,0x06,
|
||||
0x06,0x06,0x07,0x07,0x08,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0a,0x0b,0x0b,0x0c,
|
||||
0x0c,0x0c},
|
||||
{ 0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,
|
||||
0x07,0x07,0x08,0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,
|
||||
0x0e,0x0e},
|
||||
{ 0x00,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,
|
||||
0x08,0x09,0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x0f,
|
||||
0x10,0x11},
|
||||
{ 0x00,0x01,0x01,0x02,0x02,0x03,0x04,0x04,0x05,0x05,0x06,0x07,0x07,0x08,0x08,
|
||||
0x09,0x0a,0x0a,0x0b,0x0b,0x0c,0x0d,0x0d,0x0e,0x0e,0x0f,0x10,0x10,0x11,0x11,
|
||||
0x12,0x13},
|
||||
{ 0x00,0x01,0x01,0x02,0x03,0x03,0x04,0x05,0x05,0x06,0x07,0x07,0x08,0x09,0x09,
|
||||
0x0a,0x0b,0x0b,0x0c,0x0d,0x0d,0x0e,0x0f,0x0f,0x10,0x11,0x11,0x12,0x13,0x13,
|
||||
0x14,0x15},
|
||||
{ 0x00,0x01,0x01,0x02,0x03,0x04,0x04,0x05,0x06,0x07,0x07,0x08,0x09,0x0a,0x0a,
|
||||
0x0b,0x0c,0x0c,0x0d,0x0e,0x0f,0x0f,0x10,0x11,0x12,0x12,0x13,0x14,0x15,0x15,
|
||||
0x16,0x17},
|
||||
{ 0x00,0x01,0x02,0x02,0x03,0x04,0x05,0x06,0x06,0x07,0x08,0x09,0x0a,0x0a,0x0b,
|
||||
0x0c,0x0d,0x0e,0x0e,0x0f,0x10,0x11,0x12,0x12,0x13,0x14,0x15,0x16,0x16,0x17,
|
||||
0x18,0x19},
|
||||
{ 0x00,0x01,0x02,0x03,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0a,0x0b,0x0c,
|
||||
0x0d,0x0e,0x0f,0x10,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x17,0x18,0x19,
|
||||
0x1a,0x1b},
|
||||
{ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,
|
||||
0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,
|
||||
0x1c,0x1d},
|
||||
{ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,
|
||||
0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,
|
||||
0x1e,0x1f}
|
||||
};
|
||||
|
||||
|
2305
source/snes9x/debug.cpp
Normal file
2305
source/snes9x/debug.cpp
Normal file
File diff suppressed because it is too large
Load Diff
168
source/snes9x/debug.h
Normal file
168
source/snes9x/debug.h
Normal file
@ -0,0 +1,168 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _DEBUG_H_
|
||||
#define _DEBUG_H_
|
||||
|
||||
START_EXTERN_C
|
||||
void S9xDoDebug ();
|
||||
void S9xTrace ();
|
||||
void S9xSA1Trace ();
|
||||
void S9xTraceMessage (const char *);
|
||||
|
||||
// Structures
|
||||
struct SBreakPoint{
|
||||
bool8 Enabled;
|
||||
uint8 Bank;
|
||||
uint16 Address;
|
||||
};
|
||||
|
||||
uint8 S9xOPrint( char *Line, uint8 Bank, uint16 Address);
|
||||
uint8 S9xSA1OPrint( char *Line, uint8 Bank, uint16 Address);
|
||||
|
||||
extern struct SBreakPoint S9xBreakpoint[ 6];
|
||||
extern char *S9xMnemonics[256];
|
||||
END_EXTERN_C
|
||||
#endif
|
||||
|
204
source/snes9x/display.h
Normal file
204
source/snes9x/display.h
Normal file
@ -0,0 +1,204 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _DISPLAY_H_
|
||||
#define _DISPLAY_H_
|
||||
|
||||
START_EXTERN_C
|
||||
// Routines the port specific code has to implement
|
||||
void S9xSetPalette ();
|
||||
void S9xTextMode ();
|
||||
void S9xGraphicsMode ();
|
||||
void S9xLoadConfigFiles(char **argv, int argc);
|
||||
char *S9xParseArgs (char **argv, int argc);
|
||||
void S9xParseArg (char **argv, int &index, int argc);
|
||||
void S9xExtraUsage ();
|
||||
|
||||
void S9xUsage ();
|
||||
void S9xInitDisplay (int argc, char **argv);
|
||||
void S9xDeinitDisplay ();
|
||||
void S9xInitInputDevices ();
|
||||
void S9xSetTitle (const char *title);
|
||||
void S9xProcessEvents (bool8 block);
|
||||
void S9xPutImage (int width, int height);
|
||||
void S9xParseDisplayArg (char **argv, int &index, int argc);
|
||||
void S9xExtraDisplayUsage ();
|
||||
void S9xToggleSoundChannel (int channel);
|
||||
void S9xSetInfoString (const char *string);
|
||||
int S9xMinCommandLineArgs ();
|
||||
void S9xNextController ();
|
||||
bool8 S9xLoadROMImage (const char *string);
|
||||
const char *S9xSelectFilename (const char *def, const char *dir,
|
||||
const char *ext, const char *title);
|
||||
|
||||
const char *S9xChooseFilename (bool8 read_only);
|
||||
bool8 S9xOpenSnapshotFile (const char *base, bool8 read_only, STREAM *file);
|
||||
void S9xCloseSnapshotFile (STREAM file);
|
||||
|
||||
const char *S9xBasename (const char *filename);
|
||||
|
||||
int S9xFStrcmp (FILE *, const char *);
|
||||
|
||||
enum s9x_getdirtype {
|
||||
DEFAULT_DIR,
|
||||
HOME_DIR,
|
||||
ROM_DIR,
|
||||
ROMFILENAME_DIR,
|
||||
SNAPSHOT_DIR,
|
||||
SRAM_DIR,
|
||||
SCREENSHOT_DIR,
|
||||
SPC_DIR,
|
||||
PATCH_DIR,
|
||||
CHEAT_DIR,
|
||||
PACK_DIR,
|
||||
BIOS_DIR,
|
||||
LOG_DIR
|
||||
};
|
||||
const char *S9xGetDirectory (enum s9x_getdirtype dirtype);
|
||||
const char *S9xGetFilename (const char *extension, enum s9x_getdirtype dirtype);
|
||||
const char *S9xGetFilenameInc (const char *, enum s9x_getdirtype);
|
||||
END_EXTERN_C
|
||||
|
||||
#endif
|
||||
|
1641
source/snes9x/dma.cpp
Normal file
1641
source/snes9x/dma.cpp
Normal file
File diff suppressed because it is too large
Load Diff
156
source/snes9x/dma.h
Normal file
156
source/snes9x/dma.h
Normal file
@ -0,0 +1,156 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _DMA_H_
|
||||
#define _DMA_H_
|
||||
|
||||
START_EXTERN_C
|
||||
void S9xResetDMA ();
|
||||
uint8 S9xDoHDMA (uint8);
|
||||
void S9xStartHDMA ();
|
||||
void S9xDoDMA (uint8);
|
||||
END_EXTERN_C
|
||||
|
||||
#endif
|
||||
|
1036
source/snes9x/dsp1.cpp
Normal file
1036
source/snes9x/dsp1.cpp
Normal file
File diff suppressed because it is too large
Load Diff
185
source/snes9x/dsp1.h
Normal file
185
source/snes9x/dsp1.h
Normal file
@ -0,0 +1,185 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef _DSP1_H_
|
||||
#define _DSP1_H_
|
||||
|
||||
extern void (*SetDSP)(uint8, uint16);
|
||||
extern uint8 (*GetDSP)(uint16);
|
||||
|
||||
void DSP1SetByte(uint8 byte, uint16 address);
|
||||
uint8 DSP1GetByte(uint16 address);
|
||||
|
||||
void DSP2SetByte(uint8 byte, uint16 address);
|
||||
uint8 DSP2GetByte(uint16 address);
|
||||
|
||||
void DSP3SetByte(uint8 byte, uint16 address);
|
||||
uint8 DSP3GetByte(uint16 address);
|
||||
void DSP3_Reset();
|
||||
|
||||
void DSP4SetByte(uint8 byte, uint16 address);
|
||||
uint8 DSP4GetByte(uint16 address);
|
||||
|
||||
struct SDSP1 {
|
||||
uint8 version;
|
||||
bool8 waiting4command;
|
||||
bool8 first_parameter;
|
||||
uint8 command;
|
||||
uint32 in_count;
|
||||
uint32 in_index;
|
||||
uint32 out_count;
|
||||
uint32 out_index;
|
||||
uint8 parameters [512];
|
||||
uint8 output [512];
|
||||
};
|
||||
|
||||
START_EXTERN_C
|
||||
void S9xResetDSP1 ();
|
||||
uint8 S9xGetDSP (uint16 Address);
|
||||
void S9xSetDSP (uint8 Byte, uint16 Address);
|
||||
END_EXTERN_C
|
||||
|
||||
extern struct SDSP1 DSP1;
|
||||
|
||||
#endif
|
1215
source/snes9x/dsp1emu.c.inc
Normal file
1215
source/snes9x/dsp1emu.c.inc
Normal file
File diff suppressed because it is too large
Load Diff
397
source/snes9x/dsp2emu.c.inc
Normal file
397
source/snes9x/dsp2emu.c.inc
Normal file
@ -0,0 +1,397 @@
|
||||
/**********************************************************************************
|
||||
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 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
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,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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/or 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 or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
uint16 DSP2Op09Word1=0;
|
||||
uint16 DSP2Op09Word2=0;
|
||||
bool DSP2Op05HasLen=false;
|
||||
int DSP2Op05Len=0;
|
||||
bool DSP2Op06HasLen=false;
|
||||
int DSP2Op06Len=0;
|
||||
uint8 DSP2Op05Transparent=0;
|
||||
|
||||
void DSP2_Op05 ()
|
||||
{
|
||||
uint8 color;
|
||||
// Overlay bitmap with transparency.
|
||||
// Input:
|
||||
//
|
||||
// Bitmap 1: i[0] <=> i[size-1]
|
||||
// Bitmap 2: i[size] <=> i[2*size-1]
|
||||
//
|
||||
// Output:
|
||||
//
|
||||
// Bitmap 3: o[0] <=> o[size-1]
|
||||
//
|
||||
// Processing:
|
||||
//
|
||||
// Process all 4-bit pixels (nibbles) in the bitmap
|
||||
//
|
||||
// if ( BM2_pixel == transparent_color )
|
||||
// pixelout = BM1_pixel
|
||||
// else
|
||||
// pixelout = BM2_pixel
|
||||
|
||||
// The max size bitmap is limited to 255 because the size parameter is a byte
|
||||
// I think size=0 is an error. The behavior of the chip on size=0 is to
|
||||
// return the last value written to DR if you read DR on Op05 with
|
||||
// size = 0. I don't think it's worth implementing this quirk unless it's
|
||||
// proven necessary.
|
||||
|
||||
int n;
|
||||
unsigned char c1;
|
||||
unsigned char c2;
|
||||
unsigned char *p1 = DSP1.parameters;
|
||||
unsigned char *p2 = &DSP1.parameters[DSP2Op05Len];
|
||||
unsigned char *p3 = DSP1.output;
|
||||
|
||||
color = DSP2Op05Transparent&0x0f;
|
||||
|
||||
for( n = 0; n < DSP2Op05Len; n++ )
|
||||
{
|
||||
c1 = *p1++;
|
||||
c2 = *p2++;
|
||||
*p3++ = ( ((c2 >> 4) == color ) ? c1 & 0xf0: c2 & 0xf0 ) |
|
||||
( ((c2 & 0x0f)==color) ? c1 & 0x0f: c2 & 0x0f );
|
||||
}
|
||||
}
|
||||
|
||||
void DSP2_Op01 ()
|
||||
{
|
||||
// Op01 size is always 32 bytes input and output.
|
||||
// The hardware does strange things if you vary the size.
|
||||
|
||||
int j;
|
||||
unsigned char c0, c1, c2, c3;
|
||||
unsigned char *p1 = DSP1.parameters;
|
||||
unsigned char *p2a = DSP1.output;
|
||||
unsigned char *p2b = &DSP1.output[16]; // halfway
|
||||
|
||||
// Process 8 blocks of 4 bytes each
|
||||
|
||||
for ( j = 0; j < 8; j++ )
|
||||
{
|
||||
c0 = *p1++;
|
||||
c1 = *p1++;
|
||||
c2 = *p1++;
|
||||
c3 = *p1++;
|
||||
|
||||
*p2a++ = (c0 & 0x10) << 3 |
|
||||
(c0 & 0x01) << 6 |
|
||||
(c1 & 0x10) << 1 |
|
||||
(c1 & 0x01) << 4 |
|
||||
(c2 & 0x10) >> 1 |
|
||||
(c2 & 0x01) << 2 |
|
||||
(c3 & 0x10) >> 3 |
|
||||
(c3 & 0x01);
|
||||
|
||||
*p2a++ = (c0 & 0x20) << 2 |
|
||||
(c0 & 0x02) << 5 |
|
||||
(c1 & 0x20) |
|
||||
(c1 & 0x02) << 3 |
|
||||
(c2 & 0x20) >> 2 |
|
||||
(c2 & 0x02) << 1 |
|
||||
(c3 & 0x20) >> 4 |
|
||||
(c3 & 0x02) >> 1;
|
||||
|
||||
*p2b++ = (c0 & 0x40) << 1 |
|
||||
(c0 & 0x04) << 4 |
|
||||
(c1 & 0x40) >> 1 |
|
||||
(c1 & 0x04) << 2 |
|
||||
(c2 & 0x40) >> 3 |
|
||||
(c2 & 0x04) |
|
||||
(c3 & 0x40) >> 5 |
|
||||
(c3 & 0x04) >> 2;
|
||||
|
||||
|
||||
*p2b++ = (c0 & 0x80) |
|
||||
(c0 & 0x08) << 3 |
|
||||
(c1 & 0x80) >> 2 |
|
||||
(c1 & 0x08) << 1 |
|
||||
(c2 & 0x80) >> 4 |
|
||||
(c2 & 0x08) >> 1 |
|
||||
(c3 & 0x80) >> 6 |
|
||||
(c3 & 0x08) >> 3;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void DSP2_Op06 ()
|
||||
{
|
||||
// Input:
|
||||
// size
|
||||
// bitmap
|
||||
|
||||
int i, j;
|
||||
|
||||
for ( i = 0, j = DSP2Op06Len - 1; i < DSP2Op06Len; i++, j-- )
|
||||
{
|
||||
DSP1.output[j] = (DSP1.parameters[i] << 4) | (DSP1.parameters[i] >> 4);
|
||||
}
|
||||
}
|
||||
|
||||
bool DSP2Op0DHasLen=false;
|
||||
int DSP2Op0DOutLen=0;
|
||||
int DSP2Op0DInLen=0;
|
||||
|
||||
#ifndef DSP2_BIT_ACCURRATE_CODE
|
||||
|
||||
// Scale bitmap based on input length out output length
|
||||
|
||||
void DSP2_Op0D()
|
||||
{
|
||||
// Overload's algorithm - use this unless doing hardware testing
|
||||
|
||||
// One note: the HW can do odd byte scaling but since we divide
|
||||
// by two to get the count of bytes this won't work well for
|
||||
// odd byte scaling (in any of the current algorithm implementations).
|
||||
// So far I haven't seen Dungeon Master use it.
|
||||
// If it does we can adjust the parameters and code to work with it
|
||||
|
||||
int i;
|
||||
int pixel_offset;
|
||||
uint8 pixelarray[512];
|
||||
|
||||
for(i=0; i<DSP2Op0DOutLen*2; i++)
|
||||
{
|
||||
pixel_offset = (i * DSP2Op0DInLen) / DSP2Op0DOutLen;
|
||||
if ( (pixel_offset&1) == 0 )
|
||||
pixelarray[i] = DSP1.parameters[pixel_offset>>1] >> 4;
|
||||
else
|
||||
pixelarray[i] = DSP1.parameters[pixel_offset>>1] & 0x0f;
|
||||
}
|
||||
|
||||
for ( i=0; i < DSP2Op0DOutLen; i++ )
|
||||
DSP1.output[i] = ( pixelarray[i<<1] << 4 ) | pixelarray[(i<<1)+1];
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void DSP2_Op0D()
|
||||
{
|
||||
// Bit accurate hardware algorithm - uses fixed point math
|
||||
// This should match the DSP2 Op0D output exactly
|
||||
// I wouldn't recommend using this unless you're doing hardware debug.
|
||||
// In some situations it has small visual artifacts that
|
||||
// are not readily apparent on a TV screen but show up clearly
|
||||
// on a monitor. Use Overload's scaling instead.
|
||||
// This is for hardware verification testing.
|
||||
//
|
||||
// One note: the HW can do odd byte scaling but since we divide
|
||||
// by two to get the count of bytes this won't work well for
|
||||
// odd byte scaling (in any of the current algorithm implementations).
|
||||
// So far I haven't seen Dungeon Master use it.
|
||||
// If it does we can adjust the parameters and code to work with it
|
||||
|
||||
|
||||
uint32 multiplier; // Any size int >= 32-bits
|
||||
uint32 pixloc; // match size of multiplier
|
||||
int i, j;
|
||||
uint8 pixelarray[512];
|
||||
|
||||
if (DSP2Op0DInLen <= DSP2Op0DOutLen)
|
||||
multiplier = 0x10000; // In our self defined fixed point 0x10000 == 1
|
||||
else
|
||||
multiplier = (DSP2Op0DInLen << 17) / ((DSP2Op0DOutLen<<1) + 1);
|
||||
|
||||
pixloc = 0;
|
||||
for ( i=0; i < DSP2Op0DOutLen * 2; i++ )
|
||||
{
|
||||
j = pixloc >> 16;
|
||||
|
||||
if ( j & 1 )
|
||||
pixelarray[i] = DSP1.parameters[j>>1] & 0x0f;
|
||||
else
|
||||
pixelarray[i] = (DSP1.parameters[j>>1] & 0xf0) >> 4;
|
||||
|
||||
pixloc += multiplier;
|
||||
}
|
||||
|
||||
for ( i=0; i < DSP2Op0DOutLen; i++ )
|
||||
DSP1.output[i] = ( pixelarray[i<<1] << 4 ) | pixelarray[(i<<1)+1];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 0 // Probably no reason to use this code - it's not quite bit accurate and it doesn't look as good as Overload's algorithm
|
||||
|
||||
void DSP2_Op0D()
|
||||
{
|
||||
// Float implementation of Neviksti's algorithm
|
||||
// This is the right algorithm to match the DSP2 bits but the precision
|
||||
// of the PC float does not match the precision of the fixed point math
|
||||
// on the DSP2 causing occasional one off data mismatches (which should
|
||||
// be no problem because its just a one pixel difference in a scaled image
|
||||
// to be displayed).
|
||||
|
||||
float multiplier;
|
||||
float pixloc;
|
||||
int i, j;
|
||||
uint8 pixelarray[512];
|
||||
|
||||
if (DSP2Op0DInLen <= DSP2Op0DOutLen)
|
||||
multiplier = (float) 1.0;
|
||||
else
|
||||
multiplier = (float) ((DSP2Op0DInLen * 2.0) / (DSP2Op0DOutLen * 2.0 + 1.0));
|
||||
|
||||
pixloc = 0.0;
|
||||
for ( i=0; i < DSP2Op0DOutLen * 2; i++ )
|
||||
{
|
||||
// j = (int)(i * multiplier);
|
||||
j = (int) pixloc;
|
||||
|
||||
if ( j & 1 )
|
||||
pixelarray[i] = DSP1.parameters[j>>1] & 0x0f;
|
||||
else
|
||||
pixelarray[i] = (DSP1.parameters[j>>1] & 0xf0) >> 4;
|
||||
|
||||
pixloc += multiplier; // use an add in the loop instead of multiply to increase loop speed
|
||||
}
|
||||
|
||||
for ( i=0; i < DSP2Op0DOutLen; i++ )
|
||||
DSP1.output[i] = ( pixelarray[i<<1] << 4 ) | pixelarray[(i<<1)+1];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
1285
source/snes9x/dsp3emu.c.inc
Normal file
1285
source/snes9x/dsp3emu.c.inc
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user