mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-23 19:19:22 +01:00
[What Was New 001]
- compiles with latest devkitppc (r15) - now uses libfat (can use front sd slot on wii) - updated menu items a bit - wiimote support - fixed: autoload sram/freeze - fixed: rom plays immediately after loading
This commit is contained in:
parent
ceacc3a72c
commit
6fb28b823a
329
Makefile
329
Makefile
@ -1,181 +1,148 @@
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# Generic makefile for Gamecube projects
|
# Clear the implicit built in rules
|
||||||
#
|
#---------------------------------------------------------------------------------
|
||||||
# Tab stops set to 4
|
.SUFFIXES:
|
||||||
# | | | |
|
#---------------------------------------------------------------------------------
|
||||||
# 0 1 2 3
|
ifeq ($(strip $(DEVKITPPC)),)
|
||||||
#---------------------------------------------------------------------------------
|
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
|
||||||
# Clear the implicit built in rules
|
endif
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
include $(DEVKITPPC)/wii_rules
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# TARGET is the name of the output
|
#---------------------------------------------------------------------------------
|
||||||
# BUILD is the directory where object files & intermediate files will be placed
|
# TARGET is the name of the output
|
||||||
# SOURCES is a list of directories containing source code
|
# BUILD is the directory where object files & intermediate files will be placed
|
||||||
# INCLUDES is a list of directories containing extra header files
|
# 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
|
TARGET := snes9xgx-mm-wii
|
||||||
SOURCES := source/snes9x source/unzip source/ngc source/smb
|
BUILD := build
|
||||||
INCLUDES := source/snes9x source/unzip source/ngc source/smb
|
SOURCES := source/snes9x source/unzip source/ngc source/smb
|
||||||
|
DATA := data
|
||||||
#---------------------------------------------------------------------------------
|
INCLUDES := source/snes9x source/unzip source/ngc source/smb
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
|
# options for code generation
|
||||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
#---------------------------------------------------------------------------------
|
||||||
-DNGC -DNO_ASM -DCPU_SHUTDOWN -DSPC700C \
|
|
||||||
-DSPC700_SHUTDOWN -DNEW_COLOUR_BLENDING \
|
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
||||||
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
|
-DNGC -DNO_ASM -DCPU_SHUTDOWN -DSPC700C \
|
||||||
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
|
-DSPC700_SHUTDOWN -DNEW_COLOUR_BLENDING \
|
||||||
-DQUICK_SAVE_SLOT=4 -DSMB_SVID='"Crunchewy"' \
|
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
|
||||||
-DSMB_IP='"192.168.1.111"' -DGW_IP='"192.168.1.1"'\
|
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
|
||||||
-DFORCE_WII=1 \
|
-DQUICK_SAVE_SLOT=3 -DSMB_SVID='"Crunchewy"' \
|
||||||
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
|
-DSMB_IP='"192.168.1.111"' -DGW_IP='"192.168.1.1"' -DFORCE_WII=1 \
|
||||||
-pipe
|
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter -pipe
|
||||||
|
CXXFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
LDFLAGS = $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map -Wl,--cref
|
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||||
|
# -mogc
|
||||||
PREFIX := powerpc-gekko-
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
#export PATH:=/c/devkitPPC_r11/bin:/bin
|
# any extra libraries we wish to link with the project
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
#---------------------------------------------------------------------------------
|
LIBS := -lfat -lwiiuse -lz -lbte -logc -lm -lfreetype
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# -logcsys
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
LIBDIRS :=
|
# list of directories containing libraries, this must be the top level containing
|
||||||
|
# include and lib
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# any extra libraries we wish to link with
|
LIBDIRS :=
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
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
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
#---------------------------------------------------------------------------------
|
||||||
# rules for different file extensions
|
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|
||||||
#---------------------------------------------------------------------------------
|
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
export CC := $(PREFIX)gcc
|
|
||||||
export CXX := $(PREFIX)g++
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
export AR := $(PREFIX)ar
|
|
||||||
export OBJCOPY := $(PREFIX)objcopy
|
#---------------------------------------------------------------------------------
|
||||||
#---------------------------------------------------------------------------------
|
# automatically build a list of object files for our project
|
||||||
# automatically build a list of object files for our project
|
#---------------------------------------------------------------------------------
|
||||||
#---------------------------------------------------------------------------------
|
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
#---------------------------------------------------------------------------------
|
||||||
#---------------------------------------------------------------------------------
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
#---------------------------------------------------------------------------------
|
||||||
export LD := $(CC)
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
else
|
export LD := $(CC)
|
||||||
export LD := $(CXX)
|
else
|
||||||
endif
|
export LD := $(CXX)
|
||||||
|
endif
|
||||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
|
||||||
|
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||||
#---------------------------------------------------------------------------------
|
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||||
# build a list of include paths
|
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
#---------------------------------------------------------------------------------
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
# build a list of include paths
|
||||||
-I$(CURDIR)/$(BUILD)
|
#---------------------------------------------------------------------------------
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
#---------------------------------------------------------------------------------
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
# build a list of library paths
|
-I$(CURDIR)/$(BUILD) \
|
||||||
#---------------------------------------------------------------------------------
|
-I$(LIBOGC_INC)
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
# build a list of library paths
|
||||||
.PHONY: $(BUILD) clean
|
#---------------------------------------------------------------------------------
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||||
#---------------------------------------------------------------------------------
|
-L$(LIBOGC_LIB)
|
||||||
$(BUILD):
|
|
||||||
@[ -d $@ ] || mkdir $@
|
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
.PHONY: $(BUILD) clean
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
clean:
|
$(BUILD):
|
||||||
@echo clean ...
|
@[ -d $@ ] || mkdir -p $@
|
||||||
@rm -fr $(BUILD) *.elf
|
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
run:
|
clean:
|
||||||
psoload $(TARGET).dol
|
@echo clean ...
|
||||||
|
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
reload:
|
#---------------------------------------------------------------------------------
|
||||||
psoload -r $(TARGET).dol
|
run:
|
||||||
|
wiiload $(OUTPUT).dol
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
else
|
reload:
|
||||||
|
wiiload -r $(OUTPUT).dol
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# main targets
|
else
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).dol: $(OUTPUT).elf
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
@echo output ... $(notdir $@)
|
|
||||||
@$(OBJCOPY) -O binary $< $@
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
$(OUTPUT).elf: $(OFILES)
|
$(OUTPUT).dol: $(OUTPUT).elf
|
||||||
@echo linking ... $(notdir $@)
|
$(OUTPUT).elf: $(OFILES)
|
||||||
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
#---------------------------------------------------------------------------------
|
# This rule links in binary data with the .jpg extension
|
||||||
# Compile Targets for C/C++
|
#---------------------------------------------------------------------------------
|
||||||
#---------------------------------------------------------------------------------
|
%.jpg.o : %.jpg
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
#---------------------------------------------------------------------------------
|
@echo $(notdir $<)
|
||||||
%.o : %.cpp
|
$(bin2o)
|
||||||
@echo Compiling ... $(notdir $<)
|
|
||||||
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
|
-include $(DEPENDS)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.c
|
endif
|
||||||
@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
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
148
Makefile.gc
Normal file
148
Makefile.gc
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Clear the implicit built in rules
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
.SUFFIXES:
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(DEVKITPPC)),)
|
||||||
|
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(DEVKITPPC)/gamecube_rules
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# 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 := $(BUILD)/snes9xgx-mm-wii
|
||||||
|
BUILD := build
|
||||||
|
SOURCES := source/snes9x source/unzip source/ngc source/smb
|
||||||
|
DATA := data
|
||||||
|
INCLUDES := source/snes9x source/unzip source/ngc source/smb
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# options for code generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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=0 \
|
||||||
|
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter -pipe
|
||||||
|
CXXFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
|
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||||
|
# -mogc
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# any extra libraries we wish to link with the project
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
LIBS := -lfat -lz -lbte -logc -lm -lfreetype -lbba
|
||||||
|
# -logcsys
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# list of directories containing libraries, this must be the top level containing
|
||||||
|
# include and lib
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
LIBDIRS :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# 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)) \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# 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)))
|
||||||
|
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
export LD := $(CC)
|
||||||
|
else
|
||||||
|
export LD := $(CXX)
|
||||||
|
endif
|
||||||
|
|
||||||
|
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||||
|
$(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) \
|
||||||
|
-I$(LIBOGC_INC)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# build a list of library paths
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||||
|
-L$(LIBOGC_LIB)
|
||||||
|
|
||||||
|
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||||
|
.PHONY: $(BUILD) clean
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(BUILD):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
run:
|
||||||
|
wiiload $(OUTPUT).dol
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
reload:
|
||||||
|
wiiload -r $(OUTPUT).dol
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(OUTPUT).dol: $(OUTPUT).elf
|
||||||
|
$(OUTPUT).elf: $(OFILES)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# This rule links in binary data with the .jpg extension
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.jpg.o : %.jpg
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
33
README.txt
33
README.txt
@ -31,7 +31,15 @@ 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.
|
GameCube. You can get more information on SNES9X here from the below URL.
|
||||||
http://snes9x.ipherswipsite.com/
|
http://snes9x.ipherswipsite.com/
|
||||||
|
|
||||||
[What's New 2.0.1b8]
|
[What's New 001]
|
||||||
|
- compiles with latest devkitppc (r15)
|
||||||
|
- now uses libfat (can use front sd slot on wii)
|
||||||
|
- updated menu items a bit
|
||||||
|
- wiimote support
|
||||||
|
- fixed: autoload sram/freeze
|
||||||
|
- fixed: rom plays immediately after loading
|
||||||
|
|
||||||
|
[What Was New 2.0.1b8]
|
||||||
* Added: SD slot B options for freezes, sram and loading of roms
|
* 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: SMB options no longer displayed in menus when run on a Wii
|
||||||
* Changed: Game auto resumes running after resetting when choosing the "Reset
|
* Changed: Game auto resumes running after resetting when choosing the "Reset
|
||||||
@ -186,6 +194,27 @@ how to do any of that. A good source for information on these topics is the
|
|||||||
tehskeen forums:
|
tehskeen forums:
|
||||||
|
|
||||||
http://www.tehskeen.com/forums/
|
http://www.tehskeen.com/forums/
|
||||||
|
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||||
|
|0O×øo· WIIMOTE CONTROLLER MAPPING ·oø×O0|
|
||||||
|
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||||
|
|
||||||
|
Wiimote SNES
|
||||||
|
---------------------
|
||||||
|
1 Y
|
||||||
|
2 B
|
||||||
|
A A
|
||||||
|
B X
|
||||||
|
- SELECT
|
||||||
|
+ START
|
||||||
|
HOME Emulator menu
|
||||||
|
LT
|
||||||
|
RT
|
||||||
|
|
||||||
|
This configuration allows you to play with the wiimote held sideways.
|
||||||
|
|
||||||
|
NOTE: snes Left Trigger and Right Trigger are not mapped.
|
||||||
|
You can change the mapping in ngc/snes9xGX.cpp (search 'wmpadmap') and recompile.
|
||||||
|
|
||||||
|
|
||||||
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
×—–—–—–—– –—–—–—–—–—–—–—–—–—–— —–—–—–—–—–—–—–—-—–-–•¬
|
||||||
|0O×øo· PARTIAL PKZIP SUPPORT ·oø×O0|
|
|0O×øo· PARTIAL PKZIP SUPPORT ·oø×O0|
|
||||||
@ -307,7 +336,7 @@ TBD
|
|||||||
GameCube Port 2.0 WIP6 and earlier - SoftDev
|
GameCube Port 2.0 WIP6 and earlier - SoftDev
|
||||||
Additional improvements to 2.0 WIP6 - eke-eke
|
Additional improvements to 2.0 WIP6 - eke-eke
|
||||||
GameCube 2.0.1bx enhancements - crunchy2
|
GameCube 2.0.1bx enhancements - crunchy2
|
||||||
>1.36 GB DVD reading on Wii - svpe
|
v001 updates - michniewski
|
||||||
GX - http://www.gc-linux.org
|
GX - http://www.gc-linux.org
|
||||||
Font - Qoob Team
|
Font - Qoob Team
|
||||||
libogc - Shagkur
|
libogc - Shagkur
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <wiiuse/wpad.h>
|
||||||
|
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
@ -37,7 +38,7 @@
|
|||||||
#include "mcsave.h"
|
#include "mcsave.h"
|
||||||
|
|
||||||
#define PAGESIZE 17
|
#define PAGESIZE 17
|
||||||
static int maxfiles;
|
int maxfiles;
|
||||||
int havedir = 0;
|
int havedir = 0;
|
||||||
int hasloaded = 0;
|
int hasloaded = 0;
|
||||||
int loadtype = 0;
|
int loadtype = 0;
|
||||||
@ -45,7 +46,9 @@ int LoadDVDFile (unsigned char *buffer);
|
|||||||
int haveSDdir = 0;
|
int haveSDdir = 0;
|
||||||
extern unsigned long ARAM_ROMSIZE;
|
extern unsigned long ARAM_ROMSIZE;
|
||||||
extern int screenheight;
|
extern int screenheight;
|
||||||
|
|
||||||
|
extern FILEENTRIES filelist[MAXFILES];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Showfile screen
|
* Showfile screen
|
||||||
*
|
*
|
||||||
@ -55,26 +58,31 @@ static void
|
|||||||
ShowFiles (int offset, int selection)
|
ShowFiles (int offset, int selection)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char text[80];
|
char text[MAXPATHLEN];
|
||||||
int ypos;
|
int ypos;
|
||||||
int w;
|
int w;
|
||||||
|
|
||||||
|
setfontsize(18);
|
||||||
clearscreen ();
|
clearscreen ();
|
||||||
|
|
||||||
setfontsize (16);
|
|
||||||
|
|
||||||
ypos = (screenheight - ((PAGESIZE - 1) * 20)) >> 1;
|
ypos = (screenheight - ((PAGESIZE - 1) * 20)) >> 1;
|
||||||
|
|
||||||
if (screenheight == 480)
|
if (screenheight == 480)
|
||||||
ypos += 24;
|
ypos += 24;
|
||||||
else
|
else
|
||||||
ypos += 10;
|
ypos += 10;
|
||||||
|
|
||||||
|
|
||||||
|
// show offset and selection at top
|
||||||
|
sprintf(text,"offset: %d, selection: %d",offset, selection);
|
||||||
|
DrawText (-1, 20, text);
|
||||||
|
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
|
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (filelist[i].flags)
|
if (filelist[i].flags) // if a dir
|
||||||
|
|
||||||
{
|
{
|
||||||
strcpy (text, "[");
|
strcpy (text, "[");
|
||||||
@ -107,8 +115,6 @@ ShowFiles (int offset, int selection)
|
|||||||
}
|
}
|
||||||
showscreen ();
|
showscreen ();
|
||||||
|
|
||||||
setfontsize (24);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -139,7 +145,7 @@ int selection = 0;
|
|||||||
int
|
int
|
||||||
FileSelector ()
|
FileSelector ()
|
||||||
{
|
{
|
||||||
short p;
|
int p, wp;
|
||||||
signed char a;
|
signed char a;
|
||||||
int haverom = 0;
|
int haverom = 0;
|
||||||
int redraw = 1;
|
int redraw = 1;
|
||||||
@ -151,8 +157,9 @@ FileSelector ()
|
|||||||
ShowFiles (offset, selection);
|
ShowFiles (offset, selection);
|
||||||
redraw = 0;
|
redraw = 0;
|
||||||
p = PAD_ButtonsDown (0);
|
p = PAD_ButtonsDown (0);
|
||||||
|
wp = WPAD_ButtonsDown (0);
|
||||||
a = PAD_StickY (0);
|
a = PAD_StickY (0);
|
||||||
if ((p & PAD_BUTTON_A) || selectit)
|
if ( (p & PAD_BUTTON_A) || (wp & WPAD_BUTTON_A) || selectit )
|
||||||
{
|
{
|
||||||
if ( selectit )
|
if ( selectit )
|
||||||
selectit = 0;
|
selectit = 0;
|
||||||
@ -165,17 +172,17 @@ FileSelector ()
|
|||||||
|
|
||||||
/* update current directory and set new entry list if directory has changed */
|
/* update current directory and set new entry list if directory has changed */
|
||||||
int status = updateSDdirname();
|
int status = updateSDdirname();
|
||||||
if (status == 1)
|
if (status == 1) // ok, open directory
|
||||||
{
|
{
|
||||||
maxfiles = parseSDdirectory();
|
maxfiles = parseSDdirectory();
|
||||||
if (!maxfiles)
|
if (!maxfiles)
|
||||||
{
|
{
|
||||||
WaitPrompt ("Error reading directory !");
|
WaitPrompt ((char*) "Error reading directory !");
|
||||||
haverom = 1; // quit SD menu
|
haverom = 1; // quit SD menu
|
||||||
haveSDdir = 0; // reset everything at next access
|
haveSDdir = 0; // reset everything at next access
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (status == -1)
|
else if (status == -1) // directory name too long
|
||||||
{
|
{
|
||||||
haverom = 1; // quit SD menu
|
haverom = 1; // quit SD menu
|
||||||
haveSDdir = 0; // reset everything at next access
|
haveSDdir = 0; // reset everything at next access
|
||||||
@ -195,7 +202,7 @@ FileSelector ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // this is a file
|
||||||
{
|
{
|
||||||
rootdir = filelist[selection].offset;
|
rootdir = filelist[selection].offset;
|
||||||
rootdirlength = filelist[selection].length;
|
rootdirlength = filelist[selection].length;
|
||||||
@ -235,21 +242,29 @@ FileSelector ()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WaitPrompt("Error loading ROM!");
|
WaitPrompt((char*) "Error loading ROM!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
redraw = 1;
|
redraw = 1;
|
||||||
}
|
} // End of A
|
||||||
if ( p & PAD_BUTTON_B )
|
if ( (p & PAD_BUTTON_B) || (wp & WPAD_BUTTON_B) )
|
||||||
{
|
{
|
||||||
while ( PAD_ButtonsDown(0) & PAD_BUTTON_B )
|
while ( (PAD_ButtonsDown(0) & PAD_BUTTON_B) || (PAD_ButtonsDown(0) & WPAD_BUTTON_B) )
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
if ((strcmp(filelist[1].filename,"..") == 0) && (strlen (filelist[0].filename) != 0))
|
//if ((strcmp(filelist[1].filename,"..") == 0) && (strlen (filelist[0].filename) != 0))
|
||||||
|
if ( strcmp(filelist[0].filename,"..") == 0 )
|
||||||
|
{
|
||||||
|
selection = 0;
|
||||||
|
selectit = 1;
|
||||||
|
}
|
||||||
|
else if ( strcmp(filelist[1].filename,"..") == 0 )
|
||||||
|
{
|
||||||
selection = selectit = 1;
|
selection = selectit = 1;
|
||||||
else
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((p & PAD_BUTTON_DOWN) || (a < -PADCAL))
|
} // End of B
|
||||||
|
if ( (p & PAD_BUTTON_DOWN) || (wp & WPAD_BUTTON_DOWN) || (a < -PADCAL) )
|
||||||
{
|
{
|
||||||
selection++;
|
selection++;
|
||||||
if (selection == maxfiles)
|
if (selection == maxfiles)
|
||||||
@ -257,8 +272,8 @@ FileSelector ()
|
|||||||
if ((selection - offset) >= PAGESIZE)
|
if ((selection - offset) >= PAGESIZE)
|
||||||
offset += PAGESIZE;
|
offset += PAGESIZE;
|
||||||
redraw = 1;
|
redraw = 1;
|
||||||
} // End of down
|
} // End of down
|
||||||
if ((p & PAD_BUTTON_UP) || (a > PADCAL))
|
if ( (p & PAD_BUTTON_UP) || (wp & WPAD_BUTTON_UP) || (a > PADCAL) )
|
||||||
{
|
{
|
||||||
selection--;
|
selection--;
|
||||||
if (selection < 0)
|
if (selection < 0)
|
||||||
@ -271,8 +286,8 @@ FileSelector ()
|
|||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
offset = 0;
|
offset = 0;
|
||||||
redraw = 1;
|
redraw = 1;
|
||||||
} // End of Up
|
} // End of Up
|
||||||
if (PAD_ButtonsHeld (0) & PAD_BUTTON_LEFT)
|
if ( (PAD_ButtonsHeld(0) & PAD_BUTTON_LEFT) || (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) )
|
||||||
{
|
{
|
||||||
/*** Go back a page ***/
|
/*** Go back a page ***/
|
||||||
selection -= PAGESIZE;
|
selection -= PAGESIZE;
|
||||||
@ -287,7 +302,7 @@ FileSelector ()
|
|||||||
offset = 0;
|
offset = 0;
|
||||||
redraw = 1;
|
redraw = 1;
|
||||||
}
|
}
|
||||||
if (PAD_ButtonsHeld (0) & PAD_BUTTON_RIGHT)
|
if ( (PAD_ButtonsHeld(0) & PAD_BUTTON_RIGHT) || (WPAD_ButtonsHeld(0) & WPAD_BUTTON_RIGHT) )
|
||||||
{
|
{
|
||||||
/*** Go forward a page ***/
|
/*** Go forward a page ***/
|
||||||
selection += PAGESIZE;
|
selection += PAGESIZE;
|
||||||
@ -315,7 +330,7 @@ OpenDVD ()
|
|||||||
|
|
||||||
if (!getpvd())
|
if (!getpvd())
|
||||||
{
|
{
|
||||||
ShowAction("Mounting DVD ... Wait");
|
ShowAction((char*) "Mounting DVD ... Wait");
|
||||||
DVD_Mount(); /* mount the DVD unit again */
|
DVD_Mount(); /* mount the DVD unit again */
|
||||||
havedir = 0; /* this may be a new DVD: content need to be parsed again */
|
havedir = 0; /* this may be a new DVD: content need to be parsed again */
|
||||||
if (!getpvd())
|
if (!getpvd())
|
||||||
@ -378,19 +393,18 @@ int
|
|||||||
OpenSD (int slot)
|
OpenSD (int slot)
|
||||||
{
|
{
|
||||||
char msg[80];
|
char msg[80];
|
||||||
|
char buf[50] = "";
|
||||||
|
|
||||||
loadtype = LOAD_SDC;
|
loadtype = LOAD_SDC;
|
||||||
|
|
||||||
if (haveSDdir == 0)
|
if (haveSDdir == 0)
|
||||||
{
|
{
|
||||||
/* don't mess with DVD entries */
|
/* don't mess with DVD entries */
|
||||||
havedir = 0;
|
havedir = 0; // gamecube only
|
||||||
|
|
||||||
/* Initialise libOGC SD functions */
|
/* get current SDCARD directory */
|
||||||
SDCARD_Init ();
|
sprintf ( currSDdir, getcwd(buf,50) ); // FIX: necessary?
|
||||||
|
|
||||||
/* Reset SDCARD root directory */
|
|
||||||
sprintf(rootSDdir,"dev%d:\\SNESROMS", slot);
|
|
||||||
|
|
||||||
/* Parse initial root directory and get entries list */
|
/* Parse initial root directory and get entries list */
|
||||||
if ((maxfiles = parseSDdirectory ()))
|
if ((maxfiles = parseSDdirectory ()))
|
||||||
@ -401,7 +415,7 @@ OpenSD (int slot)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* no entries found */
|
/* no entries found */
|
||||||
sprintf (msg, "SNESROMS not found on SDCARD (slot %s)", slot ? "B" : "A");
|
sprintf (msg, "SNESROMS not found on SDCARD"); // FIX: update error msg
|
||||||
WaitPrompt (msg);
|
WaitPrompt (msg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -440,7 +454,7 @@ LoadDVDFile (unsigned char *buffer)
|
|||||||
blocks = rootdirlength / 2048;
|
blocks = rootdirlength / 2048;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
discoffset = rootdir;
|
discoffset = rootdir;
|
||||||
ShowAction ("Loading ... Wait");
|
ShowAction ((char*) "Loading ... Wait");
|
||||||
dvd_read (readbuffer, 2048, discoffset);
|
dvd_read (readbuffer, 2048, discoffset);
|
||||||
|
|
||||||
if (!IsZipFile (readbuffer))
|
if (!IsZipFile (readbuffer))
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <wiiuse/wpad.h>
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
@ -75,6 +76,7 @@ FT_Init ()
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
setfontsize (16);
|
setfontsize (16);
|
||||||
|
setfontcolour (0xff, 0xff, 0xff);
|
||||||
|
|
||||||
slot = face->glyph;
|
slot = face->glyph;
|
||||||
|
|
||||||
@ -220,22 +222,23 @@ licence ()
|
|||||||
else
|
else
|
||||||
ypos += 24;
|
ypos += 24;
|
||||||
|
|
||||||
|
setfontsize (16); // FIX
|
||||||
setfontcolour (0x00, 0x00, 0x00);
|
setfontcolour (0x00, 0x00, 0x00);
|
||||||
|
|
||||||
DrawText (-1, ypos += 40, "Snes9x - Copyright (c) Snes9x Team 1996 - 2006");
|
DrawText (-1, ypos += 40, (char*)"Snes9x - Copyright (c) Snes9x Team 1996 - 2006");
|
||||||
|
|
||||||
DrawText (-1, ypos += 40, "This is free software, and you are welcome to");
|
DrawText (-1, ypos += 40, (char*)"This is free software, and you are welcome to");
|
||||||
DrawText (-1, ypos += 20, "redistribute it under the conditions of the");
|
DrawText (-1, ypos += 20, (char*)"redistribute it under the conditions of the");
|
||||||
DrawText (-1, ypos += 20, "GNU GENERAL PUBLIC LICENSE Version 2");
|
DrawText (-1, ypos += 20, (char*)"GNU GENERAL PUBLIC LICENSE Version 2");
|
||||||
DrawText (-1, ypos +=
|
DrawText (-1, ypos +=
|
||||||
20, "Additionally, the developers of this port disclaims");
|
20, (char*)"Additionally, the developers of this port disclaims");
|
||||||
DrawText (-1, ypos +=
|
DrawText (-1, ypos +=
|
||||||
20, "all copyright interests in the Nintendo GameCube");
|
20, (char*)"all copyright interests in the Nintendo GameCube");
|
||||||
DrawText (-1, ypos +=
|
DrawText (-1, ypos +=
|
||||||
20, "porting code. You are free to use it as you wish");
|
20, (char*)"porting code. You are free to use it as you wish");
|
||||||
|
|
||||||
DrawText (-1, ypos += 40, "Developed with DevkitPPC and libOGC");
|
DrawText (-1, ypos += 40, (char*)"Developed with DevkitPPC and libOGC");
|
||||||
DrawText (-1, ypos += 20, "http://www.devkitpro.org");
|
DrawText (-1, ypos += 20, (char*)"http://www.devkitpro.org");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,8 +380,8 @@ legal ()
|
|||||||
void
|
void
|
||||||
WaitButtonA ()
|
WaitButtonA ()
|
||||||
{
|
{
|
||||||
while (PAD_ButtonsDown (0) & PAD_BUTTON_A);
|
while ( (PAD_ButtonsDown (0) & PAD_BUTTON_A) || (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) );
|
||||||
while (!(PAD_ButtonsDown (0) & PAD_BUTTON_A));
|
while (!(PAD_ButtonsDown (0) & PAD_BUTTON_A) && !(WPAD_ButtonsDown(0) & WPAD_BUTTON_A) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -387,16 +390,17 @@ WaitButtonA ()
|
|||||||
int
|
int
|
||||||
WaitButtonAB ()
|
WaitButtonAB ()
|
||||||
{
|
{
|
||||||
int btns;
|
u32 gc_btns, wm_btns;
|
||||||
|
|
||||||
while ( (PAD_ButtonsDown (0) & (PAD_BUTTON_A | PAD_BUTTON_B)) );
|
while ( (PAD_ButtonsDown (0) & (PAD_BUTTON_A | PAD_BUTTON_B)) || (WPAD_ButtonsDown(0) & (WPAD_BUTTON_A | WPAD_BUTTON_B)) );
|
||||||
|
|
||||||
while ( TRUE )
|
while ( TRUE )
|
||||||
{
|
{
|
||||||
btns = PAD_ButtonsDown (0);
|
gc_btns = PAD_ButtonsDown (0);
|
||||||
if ( btns & PAD_BUTTON_A )
|
wm_btns = WPAD_ButtonsDown (0);
|
||||||
|
if ( (gc_btns & PAD_BUTTON_A) || (wm_btns & WPAD_BUTTON_A) )
|
||||||
return 1;
|
return 1;
|
||||||
else if ( btns & PAD_BUTTON_B )
|
else if ( (gc_btns & PAD_BUTTON_B) || (wm_btns & WPAD_BUTTON_B) )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,7 +421,7 @@ WaitPrompt (char *msg)
|
|||||||
clearscreen ();
|
clearscreen ();
|
||||||
DrawText (-1, ypos, msg);
|
DrawText (-1, ypos, msg);
|
||||||
ypos += 30;
|
ypos += 30;
|
||||||
DrawText (-1, ypos, "Press A to continue");
|
DrawText (-1, ypos, (char*)"Press A to continue");
|
||||||
showscreen ();
|
showscreen ();
|
||||||
WaitButtonA ();
|
WaitButtonA ();
|
||||||
}
|
}
|
||||||
@ -531,7 +535,7 @@ RunMenu (char items[][20], int maxitems, char *title)
|
|||||||
{
|
{
|
||||||
int redraw = 1;
|
int redraw = 1;
|
||||||
int quit = 0;
|
int quit = 0;
|
||||||
short p;
|
int p, wp;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
signed char a;
|
signed char a;
|
||||||
|
|
||||||
@ -545,29 +549,30 @@ RunMenu (char items[][20], int maxitems, char *title)
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = PAD_ButtonsDown (0);
|
p = PAD_ButtonsDown (0);
|
||||||
|
wp = WPAD_ButtonsDown (0);
|
||||||
a = PAD_StickY (0);
|
a = PAD_StickY (0);
|
||||||
|
|
||||||
/*** Look for up ***/
|
/*** Look for up ***/
|
||||||
if ((p & PAD_BUTTON_UP) || (a > 70))
|
if ((p & PAD_BUTTON_UP) || (wp & WPAD_BUTTON_UP) || (a > 70))
|
||||||
{
|
{
|
||||||
redraw = 1;
|
redraw = 1;
|
||||||
menu--;
|
menu--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Look for down ***/
|
/*** Look for down ***/
|
||||||
if ((p & PAD_BUTTON_DOWN) || (a < -70))
|
if ((p & PAD_BUTTON_DOWN) || (wp & WPAD_BUTTON_DOWN) || (a < -70))
|
||||||
{
|
{
|
||||||
redraw = 1;
|
redraw = 1;
|
||||||
menu++;
|
menu++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p & PAD_BUTTON_A)
|
if ((p & PAD_BUTTON_A) || (wp & WPAD_BUTTON_A))
|
||||||
{
|
{
|
||||||
quit = 1;
|
quit = 1;
|
||||||
ret = menu;
|
ret = menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p & PAD_BUTTON_B)
|
if ((p & PAD_BUTTON_B) || (wp & WPAD_BUTTON_B))
|
||||||
{
|
{
|
||||||
quit = -1;
|
quit = -1;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -580,10 +585,10 @@ RunMenu (char items[][20], int maxitems, char *title)
|
|||||||
menu = maxitems - 1;
|
menu = maxitems - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PAD_ButtonsDown (0) & PAD_BUTTON_B)
|
if ((PAD_ButtonsDown(0) & PAD_BUTTON_B) || (WPAD_ButtonsDown(0) & WPAD_BUTTON_B))
|
||||||
{
|
{
|
||||||
/*** Wait for B button to be released before proceeding ***/
|
/*** Wait for B button to be released before proceeding ***/
|
||||||
while (PAD_ButtonsDown (0) & PAD_BUTTON_B)
|
while ((PAD_ButtonsDown(0) & PAD_BUTTON_B) || (WPAD_ButtonsDown(0) & WPAD_BUTTON_B))
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -2,20 +2,9 @@
|
|||||||
* gctime.h
|
* gctime.h
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define mftb(rval) ({unsigned long u; do { \
|
extern "C" {
|
||||||
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);
|
|
||||||
|
|
||||||
|
long long gettime();
|
||||||
|
u32 diff_usec(long long start,long long end);
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
@ -100,11 +101,11 @@ int MountCard(int cslot)
|
|||||||
while ( tries < 3 && ret == CARD_ERROR_IOERROR )
|
while ( tries < 3 && ret == CARD_ERROR_IOERROR )
|
||||||
{
|
{
|
||||||
if (cslot == CARD_SLOTA)
|
if (cslot == CARD_SLOTA)
|
||||||
WaitPrompt("Replug card in slot A!");
|
WaitPrompt((char*) "Replug card in slot A!");
|
||||||
else
|
else
|
||||||
WaitPrompt("Replug card in slot B!");
|
WaitPrompt((char*) "Replug card in slot B!");
|
||||||
|
|
||||||
ShowAction("");
|
ShowAction ((char*) "");
|
||||||
ret = CARD_Mount (cslot, SysArea, NULL);
|
ret = CARD_Mount (cslot, SysArea, NULL);
|
||||||
tries++;
|
tries++;
|
||||||
}
|
}
|
||||||
@ -112,10 +113,10 @@ int MountCard(int cslot)
|
|||||||
tries = 0;
|
tries = 0;
|
||||||
while ( tries < 5 && ret == CARD_ERROR_NOCARD )
|
while ( tries < 5 && ret == CARD_ERROR_NOCARD )
|
||||||
{
|
{
|
||||||
ShowAction("Mounting card...");
|
ShowAction ((char*) "Mounting card...");
|
||||||
CARD_Unmount (cslot);
|
CARD_Unmount (cslot);
|
||||||
usleep(500000); // wait half second
|
usleep(500000); // wait half second
|
||||||
ShowAction("");
|
ShowAction ((char*) "");
|
||||||
usleep(500000); // wait half second
|
usleep(500000); // wait half second
|
||||||
ret = CARD_Mount (cslot, SysArea, NULL);
|
ret = CARD_Mount (cslot, SysArea, NULL);
|
||||||
tries++;
|
tries++;
|
||||||
@ -124,9 +125,9 @@ int MountCard(int cslot)
|
|||||||
tries = 0;
|
tries = 0;
|
||||||
while ( tries < 5 && ret == CARD_ERROR_UNLOCKED )
|
while ( tries < 5 && ret == CARD_ERROR_UNLOCKED )
|
||||||
{
|
{
|
||||||
ShowAction("Waiting for unlock...");
|
ShowAction ((char*) "Waiting for unlock...");
|
||||||
usleep(500000); // wait half second
|
usleep(500000); // wait half second
|
||||||
ShowAction("");
|
ShowAction ((char*) "");
|
||||||
usleep(500000); // wait half second
|
usleep(500000); // wait half second
|
||||||
ret = CARD_Probe(cslot);
|
ret = CARD_Probe(cslot);
|
||||||
tries++;
|
tries++;
|
||||||
@ -164,7 +165,7 @@ VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize)
|
|||||||
if (!CardFileExists (filename, slot))
|
if (!CardFileExists (filename, slot))
|
||||||
{
|
{
|
||||||
CARD_Unmount (slot);
|
CARD_Unmount (slot);
|
||||||
WaitPrompt ("Unable to open file for verify!");
|
WaitPrompt((char*) "Unable to open file for verify!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +193,7 @@ VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize)
|
|||||||
{
|
{
|
||||||
CARD_Close (&CardFile);
|
CARD_Close (&CardFile);
|
||||||
CARD_Unmount (slot);
|
CARD_Unmount (slot);
|
||||||
WaitPrompt ("File did not verify!");
|
WaitPrompt((char*) "File did not verify!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,9 +210,9 @@ VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (slot == CARD_SLOTA)
|
if (slot == CARD_SLOTA)
|
||||||
WaitPrompt ("Unable to Mount Slot A Memory Card!");
|
WaitPrompt((char*) "Unable to Mount Slot A Memory Card!");
|
||||||
else
|
else
|
||||||
WaitPrompt ("Unable to Mount Slot B Memory Card!");
|
WaitPrompt((char*) "Unable to Mount Slot B Memory Card!");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -245,7 +246,7 @@ LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent)
|
|||||||
if (!CardFileExists (filename, slot))
|
if (!CardFileExists (filename, slot))
|
||||||
{
|
{
|
||||||
if ( !silent )
|
if ( !silent )
|
||||||
WaitPrompt ("Unable to open file");
|
WaitPrompt((char*) "Unable to open file");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,9 +279,9 @@ LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (slot == CARD_SLOTA)
|
if (slot == CARD_SLOTA)
|
||||||
WaitPrompt ("Unable to Mount Slot A Memory Card!");
|
WaitPrompt((char*) "Unable to Mount Slot A Memory Card!");
|
||||||
else
|
else
|
||||||
WaitPrompt ("Unable to Mount Slot B Memory Card!");
|
WaitPrompt((char*) "Unable to Mount Slot B Memory Card!");
|
||||||
|
|
||||||
return bytesread;
|
return bytesread;
|
||||||
}
|
}
|
||||||
@ -324,7 +325,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
CARD_Unmount (slot);
|
CARD_Unmount (slot);
|
||||||
WaitPrompt ("Unable to open card file!");
|
WaitPrompt((char*) "Unable to open card file!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,7 +338,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
|||||||
// if (CardError)
|
// if (CardError)
|
||||||
// {
|
// {
|
||||||
// CARD_Unmount (slot);
|
// CARD_Unmount (slot);
|
||||||
// WaitPrompt ("Unable to delete existing file!");
|
// WaitPrompt((char*) "Unable to delete existing file!");
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@ -346,7 +347,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
|||||||
// if (CardError)
|
// if (CardError)
|
||||||
// {
|
// {
|
||||||
// CARD_Unmount (slot);
|
// CARD_Unmount (slot);
|
||||||
// WaitPrompt ("Unable to create updated card file!");
|
// WaitPrompt((char*) "Unable to create updated card file!");
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@ -362,7 +363,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
CARD_Unmount (slot);
|
CARD_Unmount (slot);
|
||||||
WaitPrompt ("Not enough space to update file!");
|
WaitPrompt((char*) "Not enough space to update file!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +373,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
CARD_Unmount (slot);
|
CARD_Unmount (slot);
|
||||||
WaitPrompt ("Unable to delete temporary file!");
|
WaitPrompt((char*) "Unable to delete temporary file!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +382,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
CARD_Unmount (slot);
|
CARD_Unmount (slot);
|
||||||
WaitPrompt ("Unable to delete existing file!");
|
WaitPrompt((char*) "Unable to delete existing file!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +391,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
CARD_Unmount (slot);
|
CARD_Unmount (slot);
|
||||||
WaitPrompt ("Unable to create updated card file!");
|
WaitPrompt((char*) "Unable to create updated card file!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,9 +404,9 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
|||||||
{
|
{
|
||||||
CARD_Unmount (slot);
|
CARD_Unmount (slot);
|
||||||
if ( CardError = CARD_ERROR_INSSPACE )
|
if ( CardError = CARD_ERROR_INSSPACE )
|
||||||
WaitPrompt ("Not enough space to create file!");
|
WaitPrompt((char*) "Not enough space to create file!");
|
||||||
else
|
else
|
||||||
WaitPrompt ("Unable to create card file!");
|
WaitPrompt((char*) "Unable to create card file!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -449,13 +450,13 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if ( !silent )
|
if ( !silent )
|
||||||
WaitPrompt ("This game does not appear to use SRAM");
|
WaitPrompt((char*) "This game does not appear to use SRAM");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (slot == CARD_SLOTA)
|
if (slot == CARD_SLOTA)
|
||||||
WaitPrompt ("Unable to Mount Slot A Memory Card!");
|
WaitPrompt((char*) "Unable to Mount Slot A Memory Card!");
|
||||||
else
|
else
|
||||||
WaitPrompt ("Unable to Mount Slot B Memory Card!");
|
WaitPrompt((char*) "Unable to Mount Slot B Memory Card!");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -469,7 +470,7 @@ LoadSRAMFromMC (int slot, int silent)
|
|||||||
{
|
{
|
||||||
char filename[128];
|
char filename[128];
|
||||||
|
|
||||||
ShowAction ("Loading SRAM from MC...");
|
ShowAction ((char*) "Loading SRAM from MC...");
|
||||||
|
|
||||||
/*** Build SRAM filename ***/
|
/*** Build SRAM filename ***/
|
||||||
sprintf (filename, "%s.srm", Memory.ROMName);
|
sprintf (filename, "%s.srm", Memory.ROMName);
|
||||||
@ -499,7 +500,7 @@ SaveSRAMToMC (int slot, int silent)
|
|||||||
int datasize;
|
int datasize;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
ShowAction ("Saving SRAM to MC...");
|
ShowAction ((char*) "Saving SRAM to MC...");
|
||||||
|
|
||||||
/*** Build SRAM filename ***/
|
/*** Build SRAM filename ***/
|
||||||
sprintf (filename, "%s.srm", Memory.ROMName);
|
sprintf (filename, "%s.srm", Memory.ROMName);
|
||||||
@ -524,7 +525,7 @@ LoadPrefsFromMC (int slot, int silent)
|
|||||||
int offset;
|
int offset;
|
||||||
char msg[80];
|
char msg[80];
|
||||||
|
|
||||||
ShowAction ("Loading Prefs from MC...");
|
ShowAction ((char*) "Loading Prefs from MC...");
|
||||||
|
|
||||||
offset = LoadBufferFromMC (savebuffer, slot, PREFS_FILE_NAME, silent);
|
offset = LoadBufferFromMC (savebuffer, slot, PREFS_FILE_NAME, silent);
|
||||||
|
|
||||||
@ -550,7 +551,7 @@ SavePrefsToMC (int slot, int silent)
|
|||||||
int offset;
|
int offset;
|
||||||
char msg[80];
|
char msg[80];
|
||||||
|
|
||||||
ShowAction ("Saving Prefs to MC...");
|
ShowAction ((char*) "Saving Prefs to MC...");
|
||||||
|
|
||||||
datasize = preparePrefsData ();
|
datasize = preparePrefsData ();
|
||||||
offset = SaveBufferToMC (savebuffer, slot, PREFS_FILE_NAME, datasize, silent);
|
offset = SaveBufferToMC (savebuffer, slot, PREFS_FILE_NAME, datasize, silent);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sdcard.h>
|
#include <fat.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include "memfile.h"
|
#include "memfile.h"
|
||||||
@ -49,6 +49,8 @@ static char membuffer[MEMBUFFER];
|
|||||||
|
|
||||||
char freezecomment[2][32] = { {"Snes9x GX 2.0.1b8 Freeze"}, {"Freeze"} };
|
char freezecomment[2][32] = { {"Snes9x GX 2.0.1b8 Freeze"}, {"Freeze"} };
|
||||||
|
|
||||||
|
extern char rootSDdir[MAXPATHLEN];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GetMem
|
* GetMem
|
||||||
@ -135,7 +137,7 @@ NGCFreezeGame (int where, bool8 silent)
|
|||||||
{
|
{
|
||||||
char filename[1024];
|
char filename[1024];
|
||||||
SMBFILE smbfile;
|
SMBFILE smbfile;
|
||||||
sd_file *handle;
|
FILE *handle;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int wrote = 0;
|
int wrote = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
@ -144,18 +146,17 @@ NGCFreezeGame (int where, bool8 silent)
|
|||||||
if (where == 4)
|
if (where == 4)
|
||||||
{
|
{
|
||||||
/*** Freeze to SMB ***/
|
/*** Freeze to SMB ***/
|
||||||
sprintf (filename, "\\%s\\%s.frz", SNESSAVEDIR, Memory.ROMName);
|
sprintf (filename, "/%s/%s.frz", SNESSAVEDIR, Memory.ROMName);
|
||||||
}
|
}
|
||||||
else if (where == 2 || where == 3)
|
else if (where == 2 || where == 3)
|
||||||
{
|
{
|
||||||
/*** Freeze to SDCard in slot A or slot B ***/
|
/*** Freeze to SDCard in slot A or slot B ***/
|
||||||
SDCARD_Init ();
|
|
||||||
|
|
||||||
#ifdef SDUSE_LFN
|
#ifdef SDUSE_LFN
|
||||||
sprintf (filename, "dev%d:\\%s\\%s.frz", where-2, SNESSAVEDIR, Memory.ROMName);
|
sprintf (filename, "%s/%s/%s.frz", rootSDdir, SNESSAVEDIR, Memory.ROMName);
|
||||||
#else
|
#else
|
||||||
/*** Until we have LFN on SD ... ***/
|
/*** Until we have LFN on SD ... ***/
|
||||||
sprintf (filename, "dev%d:\\%s\\%08x.frz", where-2, SNESSAVEDIR, Memory.ROMCRC32);
|
sprintf (filename, "%s/%s/%08x.frz", rootSDdir, SNESSAVEDIR, Memory.ROMCRC32);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -181,7 +182,7 @@ NGCFreezeGame (int where, bool8 silent)
|
|||||||
|
|
||||||
if (smbfile)
|
if (smbfile)
|
||||||
{
|
{
|
||||||
ShowAction ("Saving freeze game...");
|
ShowAction ((char*) "Saving freeze game...");
|
||||||
|
|
||||||
len = bufoffset;
|
len = bufoffset;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
@ -217,17 +218,17 @@ NGCFreezeGame (int where, bool8 silent)
|
|||||||
}
|
}
|
||||||
else if (where == 2 || where == 3) /*** SDCard slot A or slot B ***/
|
else if (where == 2 || where == 3) /*** SDCard slot A or slot B ***/
|
||||||
{
|
{
|
||||||
handle = SDCARD_OpenFile (filename, "wb");
|
handle = fopen (filename, "wb");
|
||||||
|
|
||||||
if (handle > 0)
|
if (handle > 0)
|
||||||
{
|
{
|
||||||
ShowAction ("Saving freeze game...");
|
ShowAction ((char*) "Saving freeze game...");
|
||||||
|
|
||||||
len = SDCARD_WriteFile (handle, membuffer, bufoffset);
|
len = fwrite (membuffer, 1, bufoffset, handle);
|
||||||
SDCARD_CloseFile (handle);
|
fclose (handle);
|
||||||
|
|
||||||
if (len != bufoffset)
|
if (len != bufoffset)
|
||||||
WaitPrompt ("Error writing freeze file");
|
WaitPrompt((char*) "Error writing freeze file");
|
||||||
else if ( !silent )
|
else if ( !silent )
|
||||||
{
|
{
|
||||||
sprintf (filename, "Written %d bytes", bufoffset);
|
sprintf (filename, "Written %d bytes", bufoffset);
|
||||||
@ -237,13 +238,13 @@ NGCFreezeGame (int where, bool8 silent)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(msg, "Couldn't save to dev%d:\\%s\\", where-2, SNESSAVEDIR);
|
sprintf(msg, "Couldn't save to %s/%s/", rootSDdir, SNESSAVEDIR);
|
||||||
WaitPrompt (msg);
|
WaitPrompt (msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /*** MC in slot A or slot B ***/
|
else /*** MC in slot A or slot B ***/
|
||||||
{
|
{
|
||||||
ShowAction ("Saving freeze game...");
|
ShowAction ((char*) "Saving freeze game...");
|
||||||
|
|
||||||
ClearSaveBuffer ();
|
ClearSaveBuffer ();
|
||||||
|
|
||||||
@ -333,7 +334,7 @@ NGCUnfreezeGame (int from, bool8 silent)
|
|||||||
{
|
{
|
||||||
char filename[1024];
|
char filename[1024];
|
||||||
SMBFILE smbfile;
|
SMBFILE smbfile;
|
||||||
sd_file *handle;
|
FILE *handle;
|
||||||
int read = 0;
|
int read = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
char msg[80];
|
char msg[80];
|
||||||
@ -352,7 +353,7 @@ NGCUnfreezeGame (int from, bool8 silent)
|
|||||||
|
|
||||||
if (smbfile)
|
if (smbfile)
|
||||||
{
|
{
|
||||||
ShowAction ("Loading freeze file...");
|
ShowAction ((char*) "Loading freeze file...");
|
||||||
while ((read =
|
while ((read =
|
||||||
SMB_Read ((char *) membuffer + offset, 1024, offset,
|
SMB_Read ((char *) membuffer + offset, 1024, offset,
|
||||||
smbfile)) > 0)
|
smbfile)) > 0)
|
||||||
@ -360,68 +361,67 @@ NGCUnfreezeGame (int from, bool8 silent)
|
|||||||
|
|
||||||
SMB_Close (smbfile);
|
SMB_Close (smbfile);
|
||||||
|
|
||||||
ShowAction ("Unpacking freeze file");
|
ShowAction ((char*) "Unpacking freeze file");
|
||||||
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
|
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
|
||||||
{
|
{
|
||||||
WaitPrompt ("Error thawing");
|
WaitPrompt((char*) "Error thawing");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !silent )
|
else if ( !silent )
|
||||||
{
|
{
|
||||||
WaitPrompt ("No freeze file found");
|
WaitPrompt((char*) "No freeze file found");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (from == 2 || from == 3) /*** From SD slot A or slot B ***/
|
else if (from == 2 || from == 3) /*** From SD slot A or slot B ***/
|
||||||
{
|
{
|
||||||
SDCARD_Init ();
|
|
||||||
|
|
||||||
#ifdef SDUSE_LFN
|
#ifdef SDUSE_LFN
|
||||||
sprintf (filename, "dev%d:\\%s\\%s.frz", from-2, SNESSAVEDIR, Memory.ROMName);
|
sprintf (filename, "%s/%s/%s.frz", rootSDdir, SNESSAVEDIR, Memory.ROMName);
|
||||||
#else
|
#else
|
||||||
/*** From SDCard ***/
|
/*** From SDCard ***/
|
||||||
sprintf (filename, "dev%d:\\%s\\%08x.frz", from-2, SNESSAVEDIR, Memory.ROMCRC32);
|
sprintf (filename, "%s/%s/%08x.frz", rootSDdir, SNESSAVEDIR, Memory.ROMCRC32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
handle = SDCARD_OpenFile (filename, "rb");
|
handle = fopen (filename, "rb");
|
||||||
|
|
||||||
if (handle > 0)
|
if (handle > 0)
|
||||||
{
|
{
|
||||||
ShowAction ("Loading freeze file...");
|
ShowAction ((char*) "Loading freeze file...");
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
/*** Usual chunks into memory ***/
|
/*** Usual chunks into memory ***/
|
||||||
while ((read = SDCARD_ReadFile (handle, membuffer + offset, 2048)) >
|
while ((read = fread (membuffer + offset, 1, 2048, handle)) >
|
||||||
0)
|
0)
|
||||||
offset += read;
|
offset += read;
|
||||||
|
|
||||||
SDCARD_CloseFile (handle);
|
fclose (handle);
|
||||||
|
|
||||||
ShowAction ("Unpacking freeze file");
|
ShowAction ((char*) "Unpacking freeze file");
|
||||||
|
|
||||||
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
|
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
|
||||||
{
|
{
|
||||||
WaitPrompt ("Error thawing");
|
WaitPrompt((char*) "Error thawing");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !silent )
|
else if ( !silent )
|
||||||
{
|
{
|
||||||
WaitPrompt ("No freeze file found");
|
WaitPrompt((char*) "No freeze file found");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /*** From MC in slot A or slot B ***/
|
else /*** From MC in slot A or slot B ***/
|
||||||
{
|
{
|
||||||
ShowAction ("Loading freeze file...");
|
ShowAction ((char*) "Loading freeze file...");
|
||||||
|
|
||||||
sprintf (filename, "%s.snz", Memory.ROMName);
|
sprintf (filename, "%s.snz", Memory.ROMName);
|
||||||
|
|
||||||
int ret = LoadBufferFromMC ( savebuffer, from, filename, silent );
|
int ret = LoadBufferFromMC ( savebuffer, from, filename, silent );
|
||||||
if ( ret )
|
if ( ret )
|
||||||
{
|
{
|
||||||
ShowAction ("Unpacking freeze file");
|
ShowAction ((char*) "Unpacking freeze file");
|
||||||
|
|
||||||
// skip the saveicon and comment
|
// skip the saveicon and comment
|
||||||
offset = (sizeof(saveicon) + 64);
|
offset = (sizeof(saveicon) + 64);
|
||||||
@ -448,13 +448,13 @@ NGCUnfreezeGame (int from, bool8 silent)
|
|||||||
|
|
||||||
if ( DestBuffSize != decompressedsize )
|
if ( DestBuffSize != decompressedsize )
|
||||||
{
|
{
|
||||||
WaitPrompt ("Unzipped size doesn't match expected size!");
|
WaitPrompt((char*) "Unzipped size doesn't match expected size!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
|
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
|
||||||
{
|
{
|
||||||
WaitPrompt ("Error thawing");
|
WaitPrompt((char*) "Error thawing");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <wiiuse/wpad.h>
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "snes9xGx.h"
|
#include "snes9xGx.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
@ -46,21 +47,28 @@ extern unsigned long ARAM_ROMSIZE;
|
|||||||
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
||||||
|
|
||||||
|
|
||||||
|
void Reboot() {
|
||||||
|
#ifdef __wii__
|
||||||
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||||
|
#else
|
||||||
|
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
||||||
|
*SOFTRESET_ADR = 0x00000000;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Freeze Manager
|
* Freeze Manager
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int freezecountwii = 9;
|
int freezecountwii = 7;
|
||||||
char freezemenuwii[][20] = { "Freeze to MC Slot A", "Thaw from MC Slot A",
|
char freezemenuwii[][20] = { "Freeze to SD", "Thaw from SD",
|
||||||
|
"Freeze to MC Slot A", "Thaw from MC Slot A",
|
||||||
"Freeze to MC Slot B", "Thaw from MC Slot B",
|
"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"
|
"Return to previous"
|
||||||
};
|
};
|
||||||
int freezecount = 11;
|
int freezecount = 9;
|
||||||
char freezemenu[][20] = { "Freeze to MC Slot A", "Thaw from MC Slot A",
|
char freezemenu[][20] = { "Freeze to SD", "Thaw from SD",
|
||||||
|
"Freeze to MC Slot A", "Thaw from MC Slot A",
|
||||||
"Freeze to MC Slot B", "Thaw from MC Slot B",
|
"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",
|
"Freeze to SMB", "Thaw from SMB",
|
||||||
"Return to previous"
|
"Return to previous"
|
||||||
};
|
};
|
||||||
@ -87,50 +95,42 @@ FreezeManager ()
|
|||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case 0:/*** Freeze to MC in slot A ***/
|
case 0:/*** Freeze to SDCard ***/
|
||||||
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);
|
NGCFreezeGame (2, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:/*** Thaw from SDCard in slot A ***/
|
case 1:/*** Thaw from SDCard***/
|
||||||
quit = loaded = NGCUnfreezeGame (2, NOTSILENT);
|
quit = loaded = NGCUnfreezeGame (2, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:/*** Freeze to SDCard in slot B ***/
|
case 2:/*** Freeze to MC in slot A ***/
|
||||||
NGCFreezeGame (3, NOTSILENT);
|
NGCFreezeGame (0, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:/*** Thaw from SDCard in slot B ***/
|
case 3:/*** Thaw from MC in slot A ***/
|
||||||
quit = loaded = NGCUnfreezeGame (3, NOTSILENT);
|
quit = loaded = NGCUnfreezeGame (0, NOTSILENT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:/*** Freeze to MC in slot B ***/
|
||||||
|
NGCFreezeGame (1, NOTSILENT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:/*** Thaw from MC in slot B ***/
|
||||||
|
quit = loaded = NGCUnfreezeGame (1, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:/*** Freeze to SMB ***/
|
case 6:/*** Freeze to SMB ***/
|
||||||
if ( !isWii )
|
if ( !isWii )
|
||||||
NGCFreezeGame (4, NOTSILENT);
|
NGCFreezeGame (4, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:/*** Thaw from SMB ***/
|
case 7:/*** Thaw from SMB ***/
|
||||||
if ( !isWii )
|
if ( !isWii )
|
||||||
quit = loaded = NGCUnfreezeGame (4, NOTSILENT);
|
quit = loaded = NGCUnfreezeGame (4, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1: /*** Button B ***/
|
case -1: /*** Button B ***/
|
||||||
case 10:
|
case 8:
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -144,13 +144,13 @@ FreezeManager ()
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Load Manager
|
* Load Manager
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int loadmancountwii = 4;
|
int loadmancountwii = 2;
|
||||||
char loadmanwii[][20] = { "Load from DVD", "Load from SD Slot A",
|
char loadmanwii[][20] = { "Load from SD",
|
||||||
"Load from SD Slot B", "Return to previous"
|
"Return to previous"
|
||||||
};
|
};
|
||||||
int loadmancount = 5;
|
int loadmancount = 4;
|
||||||
char loadman[][20] = { "Load from DVD", "Load from SD Slot A",
|
char loadman[][20] = { "Load from SD",
|
||||||
"Load from SD Slot B", "Load from SMB", "Return to previous"
|
"Load from DVD", "Load from SMB", "Return to previous"
|
||||||
};
|
};
|
||||||
int
|
int
|
||||||
LoadManager ()
|
LoadManager ()
|
||||||
@ -158,67 +158,60 @@ LoadManager ()
|
|||||||
int ret;
|
int ret;
|
||||||
int quit = 0;
|
int quit = 0;
|
||||||
int oldmenu = menu;
|
int oldmenu = menu;
|
||||||
int retval = 0;
|
int retval = 1;
|
||||||
menu = 0;
|
menu = 0;
|
||||||
|
|
||||||
while (quit == 0)
|
while (quit == 0)
|
||||||
{
|
{
|
||||||
if ( LOAD_TYPE )
|
if ( isWii ) /* Wii menu */
|
||||||
ret = LOAD_TYPE-1;
|
{
|
||||||
else
|
ret = RunMenu (loadmanwii, loadmancountwii, (char*)"Load Manager");
|
||||||
{
|
if (ret >= loadmancountwii-1)
|
||||||
if ( isWii ) /* Wii menu */
|
ret = loadmancount-1;
|
||||||
{
|
}
|
||||||
ret = RunMenu (loadmanwii, loadmancountwii, "Load Manager");
|
else /* Gamecube menu */
|
||||||
if (ret >= loadmancountwii-1)
|
ret = RunMenu (loadman, loadmancount, (char*)"Load Manager");
|
||||||
ret = loadmancount-1;
|
|
||||||
}
|
|
||||||
else /* Gamecube menu */
|
|
||||||
ret = RunMenu (loadman, loadmancount, "Load Manager");
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/*** Load from DVD ***/
|
/*** Load from SD ***/
|
||||||
retval = OpenDVD ();
|
quit = OpenSD (0);
|
||||||
if ( LOAD_TYPE )
|
|
||||||
quit = 1;
|
|
||||||
else
|
|
||||||
quit = retval;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
retval = OpenSD (CARD_SLOTA);
|
/*** Load from DVD ***/
|
||||||
if ( LOAD_TYPE )
|
quit = OpenDVD ();
|
||||||
quit = 1;
|
|
||||||
else
|
|
||||||
quit = retval;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
retval = OpenSD (CARD_SLOTB);
|
/*** Load from SMB ***/ //(gamecube option)
|
||||||
if ( LOAD_TYPE )
|
quit = OpenSMB ();
|
||||||
quit = 1;
|
break;
|
||||||
else
|
|
||||||
quit = retval;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
retval = OpenSMB ();
|
|
||||||
if ( LOAD_TYPE )
|
|
||||||
quit = 1;
|
|
||||||
else
|
|
||||||
quit = retval;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case -1: /*** Button B ***/
|
case -1: /*** Button B ***/
|
||||||
case 4:
|
case 3:
|
||||||
retval = 0;
|
retval = 0;
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* check for autoloadsram / freeze
|
||||||
|
***/
|
||||||
|
if ( retval == 1 ) // 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 );
|
||||||
|
}
|
||||||
|
S9xSoftReset(); // reset after loading sram
|
||||||
|
}
|
||||||
|
|
||||||
menu = oldmenu;
|
menu = oldmenu;
|
||||||
return retval;
|
return retval;
|
||||||
@ -227,18 +220,16 @@ LoadManager ()
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Save Manager
|
* Save Manager
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int savecountwii = 9;
|
int savecountwii = 7;
|
||||||
char savemenuwii[][20] = { "Save to MC SLOT A", "Load from MC SLOT A",
|
char savemenuwii[][20] = { "Save to SD", "Load from SD",
|
||||||
|
"Save to MC SLOT A", "Load from MC SLOT A",
|
||||||
"Save to MC SLOT B", "Load from MC SLOT B",
|
"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"
|
"Return to previous"
|
||||||
};
|
};
|
||||||
int savecount = 11;
|
int savecount = 9;
|
||||||
char savemenu[][20] = { "Save to MC SLOT A", "Load from MC SLOT A",
|
char savemenu[][20] = { "Save to SD", "Load from SD",
|
||||||
|
"Save to MC SLOT A", "Load from MC SLOT A",
|
||||||
"Save to MC SLOT B", "Load from MC SLOT B",
|
"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",
|
"Save to SMB", "Load from SMB",
|
||||||
"Return to previous"
|
"Return to previous"
|
||||||
};
|
};
|
||||||
@ -254,67 +245,57 @@ SaveManager ()
|
|||||||
{
|
{
|
||||||
if ( isWii ) /* Wii menu */
|
if ( isWii ) /* Wii menu */
|
||||||
{
|
{
|
||||||
ret = RunMenu (savemenuwii, savecountwii, "Save Manager");
|
ret = RunMenu (savemenuwii, savecountwii, (char*)"Save Manager");
|
||||||
if (ret >= savecountwii-1)
|
if (ret >= savecountwii-1)
|
||||||
ret = savecount-1;
|
ret = savecount-1;
|
||||||
}
|
}
|
||||||
else /* Gamecube menu */
|
else /* Gamecube menu */
|
||||||
ret = RunMenu (savemenu, savecount, "Save Manager");
|
ret = RunMenu (savemenu, savecount, (char*)"Save Manager");
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
/*** Save to SD***/
|
||||||
|
SaveSRAMToSD (0, NOTSILENT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
/*** Load from SD***/
|
||||||
|
LoadSRAMFromSD (0, NOTSILENT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
/*** Save to MC slot A ***/
|
/*** Save to MC slot A ***/
|
||||||
SaveSRAMToMC (CARD_SLOTA, NOTSILENT);
|
SaveSRAMToMC (CARD_SLOTA, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 3:
|
||||||
/*** Load from MC slot A ***/
|
/*** Load from MC slot A ***/
|
||||||
LoadSRAMFromMC (CARD_SLOTA, NOTSILENT);
|
LoadSRAMFromMC (CARD_SLOTA, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 4:
|
||||||
/*** Save to MC slot B ***/
|
/*** Save to MC slot B ***/
|
||||||
SaveSRAMToMC (CARD_SLOTB, NOTSILENT);
|
SaveSRAMToMC (CARD_SLOTB, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 5:
|
||||||
/*** Load from MC slot B ***/
|
/*** Load from MC slot B ***/
|
||||||
LoadSRAMFromMC (CARD_SLOTB, NOTSILENT);
|
LoadSRAMFromMC (CARD_SLOTB, NOTSILENT);
|
||||||
break;
|
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:
|
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 **/
|
/*** Save to SMB **/
|
||||||
SaveSRAMToSMB (NOTSILENT);
|
SaveSRAMToSMB (NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:
|
case 7:
|
||||||
/*** Load from SMB ***/
|
/*** Load from SMB ***/
|
||||||
LoadSRAMFromSMB (NOTSILENT);
|
LoadSRAMFromSMB (NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1: /*** Button B ***/
|
case -1: /*** Button B ***/
|
||||||
case 10:
|
case 8:
|
||||||
/*** Return ***/
|
/*** Return ***/
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
@ -375,7 +356,7 @@ EmulatorOptions ()
|
|||||||
sprintf (emulatorOptions[8], "Verify MC Saves %s",
|
sprintf (emulatorOptions[8], "Verify MC Saves %s",
|
||||||
GCSettings.VerifySaves == true ? " ON" : "OFF");
|
GCSettings.VerifySaves == true ? " ON" : "OFF");
|
||||||
|
|
||||||
ret = RunMenu (emulatorOptions, emuCount, "Emulator Options");
|
ret = RunMenu (emulatorOptions, emuCount, (char*)"Emulator Options");
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
@ -494,7 +475,7 @@ ConfigureJoyPads ()
|
|||||||
|
|
||||||
sprintf (padmenu[4], "ANALOG CLIP - %d", padcal);
|
sprintf (padmenu[4], "ANALOG CLIP - %d", padcal);
|
||||||
|
|
||||||
ret = RunMenu (padmenu, padcount, "Configure Joypads");
|
ret = RunMenu (padmenu, padcount, (char*)"Configure Joypads");
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
@ -538,7 +519,7 @@ ConfigureJoyPads ()
|
|||||||
if ( ARAM_ROMSIZE > 0 )
|
if ( ARAM_ROMSIZE > 0 )
|
||||||
quickSaveSRAM(NOTSILENT);
|
quickSaveSRAM(NOTSILENT);
|
||||||
else
|
else
|
||||||
WaitPrompt ("No ROM loaded - can't save SRAM");
|
WaitPrompt((char*) "No ROM loaded - can't save SRAM");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -560,8 +541,8 @@ int menucount = 10;
|
|||||||
char menuitems[][20] = { "Choose Game",
|
char menuitems[][20] = { "Choose Game",
|
||||||
"SRAM Manager", "Freeze Manager",
|
"SRAM Manager", "Freeze Manager",
|
||||||
"Configure Joypads", "Emulator Options",
|
"Configure Joypads", "Emulator Options",
|
||||||
"Reset Game", "Stop DVD Drive", "PSO Reload",
|
"Reset Game", "Stop DVD Drive", "Exit to Loader",
|
||||||
"Reset Gamecube", "Return to Game"
|
"Reboot System", "Return to Game"
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -581,24 +562,13 @@ mainmenu ()
|
|||||||
|
|
||||||
while (quit == 0)
|
while (quit == 0)
|
||||||
{
|
{
|
||||||
ret = RunMenu (menuitems, menucount, "Main Menu");
|
ret = RunMenu (menuitems, menucount, (char*)"Main Menu");
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/*** Load ROM Menu ***/
|
/*** Load ROM Menu ***/
|
||||||
quit = LoadManager ();
|
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;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
@ -606,7 +576,7 @@ mainmenu ()
|
|||||||
if ( ARAM_ROMSIZE > 0 )
|
if ( ARAM_ROMSIZE > 0 )
|
||||||
SaveManager ();
|
SaveManager ();
|
||||||
else
|
else
|
||||||
WaitPrompt ("No ROM is loaded!");
|
WaitPrompt((char*) "No ROM is loaded!");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
@ -614,7 +584,7 @@ mainmenu ()
|
|||||||
if ( ARAM_ROMSIZE > 0 )
|
if ( ARAM_ROMSIZE > 0 )
|
||||||
quit = FreezeManager ();
|
quit = FreezeManager ();
|
||||||
else
|
else
|
||||||
WaitPrompt ("No ROM is loaded!");
|
WaitPrompt((char*) "No ROM is loaded!");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
@ -639,14 +609,18 @@ mainmenu ()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
/*** PSO Reload ***/
|
/*** Exit to Loader ***/
|
||||||
|
#ifdef __wii__
|
||||||
|
exit(0);
|
||||||
|
#else // gamecube
|
||||||
if (psoid[0] == PSOSDLOADID)
|
if (psoid[0] == PSOSDLOADID)
|
||||||
PSOReload ();
|
PSOReload ();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
/*** Reset the Gamecube ***/
|
/*** Reset the Gamecube/Wii ***/
|
||||||
*SOFTRESET_ADR = 0x00000000;
|
Reboot();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1: /*** Button B ***/
|
case -1: /*** Button B ***/
|
||||||
@ -660,7 +634,7 @@ mainmenu ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*** Remove any still held buttons ***/
|
/*** Remove any still held buttons ***/
|
||||||
while( PAD_ButtonsHeld(0) )
|
while( PAD_ButtonsHeld(0) || WPAD_ButtonsHeld(0) )
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ preparePrefsData ()
|
|||||||
int offset = sizeof (saveicon);
|
int offset = sizeof (saveicon);
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
memset (savebuffer, 0, 0x22000);
|
memset (savebuffer, 0, SAVEBUFFERSIZE);
|
||||||
|
|
||||||
/*** Copy in save icon ***/
|
/*** Copy in save icon ***/
|
||||||
memcpy (savebuffer, saveicon, offset);
|
memcpy (savebuffer, saveicon, offset);
|
||||||
@ -83,7 +83,7 @@ decodePrefsData ()
|
|||||||
memcpy (&GCSettings, savebuffer + offset, sizeof (GCSettings));
|
memcpy (&GCSettings, savebuffer + offset, sizeof (GCSettings));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WaitPrompt("Preferences reset - check settings!");
|
WaitPrompt((char*) "Preferences reset - check settings!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void quickLoadPrefs (bool8 silent)
|
void quickLoadPrefs (bool8 silent)
|
||||||
|
@ -158,6 +158,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
@ -180,8 +181,8 @@
|
|||||||
|
|
||||||
extern u32 FrameTimer;
|
extern u32 FrameTimer;
|
||||||
|
|
||||||
tb_t prev;
|
long long prev;
|
||||||
tb_t now;
|
long long now;
|
||||||
|
|
||||||
|
|
||||||
/*** Miscellaneous Functions ***/
|
/*** Miscellaneous Functions ***/
|
||||||
@ -285,19 +286,20 @@ S9xGenerateSound ()
|
|||||||
void S9xInitSync()
|
void S9xInitSync()
|
||||||
{
|
{
|
||||||
FrameTimer = 0;
|
FrameTimer = 0;
|
||||||
mftb(&prev);
|
prev = gettime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Synchronisation ***/
|
/*** Synchronisation ***/
|
||||||
void
|
extern int timerstyle;
|
||||||
S9xSyncSpeed ()
|
|
||||||
|
void S9xSyncSpeed ()
|
||||||
{
|
{
|
||||||
uint32 skipFrms = Settings.SkipFrames;
|
uint32 skipFrms = Settings.SkipFrames;
|
||||||
|
|
||||||
if ( Settings.TurboMode )
|
if ( Settings.TurboMode )
|
||||||
skipFrms = Settings.TurboSkipFrames;
|
skipFrms = Settings.TurboSkipFrames;
|
||||||
|
|
||||||
if ( !Settings.PAL ) /* use NGC vertical sync (VSYNC) with NTSC roms */
|
if ( timerstyle == 0 ) /* use NGC vertical sync (VSYNC) with NTSC roms */
|
||||||
{
|
{
|
||||||
while (FrameTimer == 0)
|
while (FrameTimer == 0)
|
||||||
{
|
{
|
||||||
@ -321,13 +323,12 @@ S9xSyncSpeed ()
|
|||||||
else /* use internal timer for PAL roms */
|
else /* use internal timer for PAL roms */
|
||||||
{
|
{
|
||||||
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
|
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
|
||||||
|
now = gettime();
|
||||||
mftb(&now);
|
|
||||||
|
|
||||||
if (tb_diff_usec(&now, &prev) > timediffallowed)
|
if (diff_usec(prev, now) > timediffallowed)
|
||||||
{
|
{
|
||||||
/*while ( tb_diff_usec(&now, &prev) < timediffallowed * 2) {
|
/*while ( diff_usec((prev, now) < timediffallowed * 2) {
|
||||||
mftb(&now);
|
now = gettime();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/* Timer has already expired */
|
/* Timer has already expired */
|
||||||
@ -345,12 +346,12 @@ S9xSyncSpeed ()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*** Ahead - so hold up ***/
|
/*** Ahead - so hold up ***/
|
||||||
while (tb_diff_usec(&now, &prev) < timediffallowed) mftb(&now);
|
while (diff_usec(prev, now) < timediffallowed) now=gettime();
|
||||||
IPPU.RenderThisFrame = TRUE;
|
IPPU.RenderThisFrame = TRUE;
|
||||||
IPPU.SkippedFrames = 0;
|
IPPU.SkippedFrames = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&prev, &now, sizeof(tb_t));
|
prev = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !Settings.TurboMode )
|
if ( !Settings.TurboMode )
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
#include "sdcard.h"
|
#include "sdload.h"
|
||||||
#include "ngcunzip.h"
|
#include "ngcunzip.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
@ -26,10 +26,13 @@
|
|||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
extern unsigned char savebuffer[];
|
extern unsigned char savebuffer[];
|
||||||
extern char output[16384];
|
extern char output[16384];
|
||||||
char rootSDdir[SDCARD_MAX_PATH_LEN];
|
FILE * filehandle;
|
||||||
|
char rootSDdir[MAXPATHLEN] = "fat:/";
|
||||||
|
char currSDdir[MAXPATHLEN];
|
||||||
extern int offset;
|
extern int offset;
|
||||||
extern int selection;
|
extern int selection;
|
||||||
|
|
||||||
|
extern FILEENTRIES filelist[MAXFILES];
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Update SDCARD curent directory name
|
* Update SDCARD curent directory name
|
||||||
@ -47,84 +50,85 @@ int updateSDdirname()
|
|||||||
else if (strcmp(filelist[selection].filename,"..") == 0)
|
else if (strcmp(filelist[selection].filename,"..") == 0)
|
||||||
{
|
{
|
||||||
/* determine last subdirectory namelength */
|
/* determine last subdirectory namelength */
|
||||||
sprintf(temp,"%s",rootSDdir);
|
sprintf(temp,"%s",currSDdir);
|
||||||
test= strtok(temp,"\\");
|
test = strtok(temp,"/");
|
||||||
while (test != NULL)
|
while (test != NULL) {
|
||||||
{
|
|
||||||
size = strlen(test);
|
size = strlen(test);
|
||||||
test = strtok(NULL,"\\");
|
test = strtok(NULL,"/");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove last subdirectory name */
|
/* remove last subdirectory name */
|
||||||
size = strlen(rootSDdir) - size - 1;
|
size = strlen(currSDdir) - size - 1;
|
||||||
rootSDdir[size] = 0;
|
currSDdir[size] = 0;
|
||||||
|
|
||||||
/* handles root name */
|
/* handles root name */
|
||||||
if (strcmp(rootSDdir,"dev0:") == 0)
|
if (strcmp(currSDdir, "/") == 0)
|
||||||
{
|
|
||||||
sprintf(rootSDdir,"dev0:\\SNESROMS");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else /* Open a directory */
|
||||||
{
|
{
|
||||||
/* test new directory namelength */
|
/* test new directory namelength */
|
||||||
if ((strlen(rootSDdir)+1+strlen(filelist[selection].filename)) < SDCARD_MAX_PATH_LEN)
|
if ((strlen(currSDdir)+1+strlen(filelist[selection].filename)) < MAXPATHLEN)
|
||||||
{
|
{
|
||||||
/* handles root name */
|
/* handles root name */
|
||||||
if (strcmp(rootSDdir,"dev0:\\SNESROMS\\..") == 0) sprintf(rootSDdir,"dev0:");
|
sprintf(temp, "/%s/..", SNESROMDIR);
|
||||||
|
if (strcmp(currSDdir, temp) == 0)
|
||||||
|
sprintf(currSDdir,"%s",rootSDdir);
|
||||||
|
|
||||||
/* update current directory name */
|
/* update current directory name */
|
||||||
sprintf(rootSDdir, "%s\\%s",rootSDdir, filelist[selection].filename);
|
sprintf(currSDdir, "%s/%s",currSDdir, filelist[selection].filename);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
else
|
WaitPrompt((char*)"Dirname is too long !");
|
||||||
{
|
return -1;
|
||||||
WaitPrompt ("Dirname is too long !");
|
}
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Browse SDCARD subdirectories
|
* Browse SDCARD subdirectories
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int parseSDdirectory()
|
int parseSDdirectory() {
|
||||||
{
|
int nbfiles = 0;
|
||||||
int entries = 0;
|
DIR_ITER *sddir;
|
||||||
int nbfiles = 0;
|
char filename[MAXPATHLEN];
|
||||||
DIR *sddir = NULL;
|
struct stat filestat;
|
||||||
char tname[1024];
|
char msg[128];
|
||||||
|
|
||||||
offset = selection = 0;
|
/* initialize selection */
|
||||||
|
selection = offset = 0;
|
||||||
/* Get a list of files from the actual root directory */
|
|
||||||
entries = SDCARD_ReadDir (rootSDdir, &sddir);
|
/* open the directory */
|
||||||
|
sddir = diropen(currSDdir);
|
||||||
if (entries < 0) entries = 0;
|
if (sddir == NULL) {
|
||||||
if (entries > MAXFILES) entries = MAXFILES;
|
sprintf(currSDdir,"%s",rootSDdir); // if we can't open the previous dir, open root dir
|
||||||
|
sddir = diropen(currSDdir);
|
||||||
|
WaitPrompt(msg);
|
||||||
|
if (sddir == NULL) {
|
||||||
|
sprintf(msg, "Error opening %s", currSDdir);
|
||||||
|
WaitPrompt(msg);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Move to DVD structure - this is required for the file selector */
|
/* Move to DVD structure - this is required for the file selector */
|
||||||
while (entries)
|
while(dirnext(sddir,filename,&filestat) == 0) {
|
||||||
{
|
if(strcmp(filename,".") != 0) {
|
||||||
memcpy (tname, &sddir[nbfiles].fname, 1024);
|
memset(&filelist[nbfiles], 0, sizeof(FILEENTRIES));
|
||||||
memset (&filelist[nbfiles], 0, sizeof (FILEENTRIES));
|
strncpy(filelist[nbfiles].filename, filename, MAXPATHLEN);
|
||||||
strncpy(filelist[nbfiles].filename,tname,MAXJOLIET+1);
|
strncpy(filelist[nbfiles].displayname, filename, MAXDISPLAY+1); // crop name for display
|
||||||
filelist[nbfiles].filename[MAXJOLIET] = 0;
|
filelist[nbfiles].length = filestat.st_size;
|
||||||
strncpy(filelist[nbfiles].displayname,tname,MAXDISPLAY+1);
|
filelist[nbfiles].flags = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1;
|
||||||
filelist[nbfiles].filename[MAXDISPLAY] = 0;
|
nbfiles++;
|
||||||
filelist[nbfiles].length = sddir[nbfiles].fsize;
|
}
|
||||||
filelist[nbfiles].flags = (char)(sddir[nbfiles].fattr & SDCARD_ATTR_DIR);
|
}
|
||||||
nbfiles++;
|
|
||||||
entries--;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Release memory ***/
|
/*** close directory ***/
|
||||||
free(sddir);
|
dirclose(sddir);
|
||||||
|
|
||||||
return nbfiles;
|
return nbfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -135,8 +139,8 @@ int
|
|||||||
LoadSDFile (char *filename, int length)
|
LoadSDFile (char *filename, int length)
|
||||||
{
|
{
|
||||||
char zipbuffer[2048];
|
char zipbuffer[2048];
|
||||||
char filepath[SDCARD_MAX_PATH_LEN];
|
char filepath[MAXPATHLEN];
|
||||||
sd_file *handle;
|
FILE *handle;
|
||||||
char *rbuffer;
|
char *rbuffer;
|
||||||
PKZIPHEADER pkzip;
|
PKZIPHEADER pkzip;
|
||||||
z_stream zs;
|
z_stream zs;
|
||||||
@ -147,100 +151,105 @@ LoadSDFile (char *filename, int length)
|
|||||||
rbuffer = (char *) Memory.ROM;
|
rbuffer = (char *) Memory.ROM;
|
||||||
|
|
||||||
/* Check filename length */
|
/* Check filename length */
|
||||||
if ((strlen(rootSDdir)+1+strlen(filelist[selection].filename)) < SDCARD_MAX_PATH_LEN)
|
if ((strlen(currSDdir)+1+strlen(filelist[selection].filename)) < MAXPATHLEN)
|
||||||
sprintf(filepath, "%s\\%s",rootSDdir,filelist[selection].filename);
|
sprintf(filepath, "%s/%s",currSDdir,filelist[selection].filename);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WaitPrompt ("Maximum Filename Length reached !");
|
WaitPrompt((char*) "Maximum Filename Length reached !");
|
||||||
haveSDdir = 0; // reset everything before next access
|
haveSDdir = 0; // reset everything before next access
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = SDCARD_OpenFile (filepath, "rb");
|
handle = fopen (filepath, "rb");
|
||||||
if (handle > 0)
|
if (handle > 0)
|
||||||
{
|
{
|
||||||
SDCARD_ReadFile (handle, zipbuffer, 2048);
|
fread (zipbuffer, 1, 2048, handle);
|
||||||
|
|
||||||
if (IsZipFile (zipbuffer))
|
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;
|
/*** Unzip the ROM ***/
|
||||||
zs.next_out = (Bytef *) output;
|
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 = inflate (&zs, Z_NO_FLUSH);
|
res = inflateInit2 (&zs, -MAX_WBITS);
|
||||||
|
|
||||||
have = 16384 - zs.avail_out;
|
if (res != Z_OK)
|
||||||
|
|
||||||
if (have)
|
|
||||||
{
|
{
|
||||||
memcpy (rbuffer + outbytes, output, have);
|
fclose (handle);
|
||||||
outbytes += have;
|
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;
|
||||||
|
fread (zipbuffer, 1, 2048, handle);
|
||||||
|
|
||||||
|
}
|
||||||
|
while (res != Z_STREAM_END
|
||||||
|
&& (u32) outbytes < pkzip.uncompressedSize);
|
||||||
|
|
||||||
|
inflateEnd (&zs);
|
||||||
|
|
||||||
|
fclose (handle);
|
||||||
|
return pkzip.uncompressedSize;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*** Just load the file up ***/
|
||||||
|
|
||||||
|
fseek(handle, 0, SEEK_END);
|
||||||
|
length = ftell(handle); // get filesize
|
||||||
|
fseek(handle, 2048, SEEK_SET); // seek back to point where we left off
|
||||||
|
|
||||||
|
sprintf (filepath, "Loading %d bytes", length);
|
||||||
|
ShowAction (filepath);
|
||||||
|
memcpy (rbuffer, zipbuffer, 2048); // copy what we already read
|
||||||
|
fread (rbuffer + 2048, 1, length - 2048, handle);
|
||||||
|
fclose (handle);
|
||||||
|
|
||||||
|
return length;
|
||||||
}
|
}
|
||||||
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
|
else
|
||||||
{
|
{
|
||||||
WaitPrompt ("Error opening file");
|
WaitPrompt((char*) "Error opening file");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,15 +262,13 @@ LoadSDFile (char *filename, int length)
|
|||||||
* Load savebuffer from SD card file
|
* Load savebuffer from SD card file
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int
|
int
|
||||||
LoadBufferFromSD (char *filepath, bool8 silent)
|
LoadBufferFromSD (char *filepath, bool silent)
|
||||||
{
|
{
|
||||||
sd_file *handle;
|
FILE *handle;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int read = 0;
|
int read = 0;
|
||||||
|
|
||||||
SDCARD_Init ();
|
handle = fopen (filepath, "rb");
|
||||||
|
|
||||||
handle = SDCARD_OpenFile (filepath, "rb");
|
|
||||||
|
|
||||||
if (handle <= 0)
|
if (handle <= 0)
|
||||||
{
|
{
|
||||||
@ -277,12 +284,12 @@ LoadBufferFromSD (char *filepath, bool8 silent)
|
|||||||
memset (savebuffer, 0, 0x22000);
|
memset (savebuffer, 0, 0x22000);
|
||||||
|
|
||||||
/*** This is really nice, just load the file and decode it ***/
|
/*** This is really nice, just load the file and decode it ***/
|
||||||
while ((read = SDCARD_ReadFile (handle, savebuffer + offset, 1024)) > 0)
|
while ((read = fread (savebuffer + offset, 1, 1024, handle)) > 0)
|
||||||
{
|
{
|
||||||
offset += read;
|
offset += read;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDCARD_CloseFile (handle);
|
fclose (handle);
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
@ -292,15 +299,13 @@ LoadBufferFromSD (char *filepath, bool8 silent)
|
|||||||
* Write savebuffer to SD card file
|
* Write savebuffer to SD card file
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int
|
int
|
||||||
SaveBufferToSD (char *filepath, int datasize, bool8 silent)
|
SaveBufferToSD (char *filepath, int datasize, bool silent)
|
||||||
{
|
{
|
||||||
sd_file *handle;
|
FILE *handle;
|
||||||
|
|
||||||
SDCARD_Init ();
|
|
||||||
|
|
||||||
if (datasize)
|
if (datasize)
|
||||||
{
|
{
|
||||||
handle = SDCARD_OpenFile (filepath, "wb");
|
handle = fopen (filepath, "wb");
|
||||||
|
|
||||||
if (handle <= 0)
|
if (handle <= 0)
|
||||||
{
|
{
|
||||||
@ -310,8 +315,8 @@ SaveBufferToSD (char *filepath, int datasize, bool8 silent)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDCARD_WriteFile (handle, savebuffer, datasize);
|
fwrite (savebuffer, 1, datasize, handle);
|
||||||
SDCARD_CloseFile (handle);
|
fclose (handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return datasize;
|
return datasize;
|
||||||
@ -321,19 +326,18 @@ SaveBufferToSD (char *filepath, int datasize, bool8 silent)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Save SRAM to SD Card
|
* Save SRAM to SD Card
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void
|
void SaveSRAMToSD (int slot, bool silent)
|
||||||
SaveSRAMToSD (uint8 slot, bool8 silent)
|
|
||||||
{
|
{
|
||||||
char filepath[1024];
|
char filepath[1024];
|
||||||
int datasize;
|
int datasize;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
ShowAction ("Saving SRAM to SD...");
|
ShowAction ((char*) "Saving SRAM to SD...");
|
||||||
|
|
||||||
#ifdef SDUSE_LFN
|
#ifdef SDUSE_LFN
|
||||||
sprintf (filepath, "dev%d:\\%s\\%s.srm", slot, SNESSAVEDIR, Memory.ROMName);
|
sprintf (filepath, "%s/%s/%s.srm", rootSDdir, SNESSAVEDIR, Memory.ROMName);
|
||||||
#else
|
#else
|
||||||
sprintf (filepath, "dev%d:\\SNESSAVE\\%08x.srm", slot, Memory.ROMCRC32);
|
sprintf (filepath, "%s/SNESSAVE/%08x.srm", rootSDdir, Memory.ROMCRC32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
datasize = prepareEXPORTsavedata ();
|
datasize = prepareEXPORTsavedata ();
|
||||||
@ -355,19 +359,17 @@ SaveSRAMToSD (uint8 slot, bool8 silent)
|
|||||||
* Load SRAM From SD Card
|
* Load SRAM From SD Card
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void
|
void
|
||||||
LoadSRAMFromSD (uint8 slot, bool8 silent)
|
LoadSRAMFromSD (int slot, bool silent)
|
||||||
{
|
{
|
||||||
char filepath[1024];
|
char filepath[1024];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
ShowAction ("Loading SRAM from SD...");
|
ShowAction ((char*) "Loading SRAM from SD...");
|
||||||
|
|
||||||
#ifdef SDUSE_LFN
|
#ifdef SDUSE_LFN
|
||||||
sprintf (filepath, "dev%d:\\%s\\%s.srm", slot, SNESSAVEDIR, Memory.ROMName);
|
sprintf (filepath, "%s/%s/%s.srm", rootSDdir, SNESSAVEDIR, Memory.ROMName);
|
||||||
// sprintf (filepath, "dev%d:\\%s.srm", Memory.ROMName);
|
|
||||||
#else
|
#else
|
||||||
sprintf (filepath, "dev%d:\\SNESSAVE\\%08x.srm", slot, Memory.ROMCRC32);
|
sprintf (filepath, "%s/%s/%08x.srm", rootSDdir, SNESSAVEDIR, Memory.ROMCRC32);
|
||||||
// sprintf (filepath, "dev0:\\%08x.srm", Memory.ROMCRC32);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
offset = LoadBufferFromSD (filepath, silent);
|
offset = LoadBufferFromSD (filepath, silent);
|
||||||
@ -389,18 +391,18 @@ LoadSRAMFromSD (uint8 slot, bool8 silent)
|
|||||||
* Save Preferences to SD Card
|
* Save Preferences to SD Card
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void
|
void
|
||||||
SavePrefsToSD (uint8 slot, bool8 silent)
|
SavePrefsToSD (int slot, bool silent)
|
||||||
{
|
{
|
||||||
char filepath[1024];
|
char filepath[1024];
|
||||||
int datasize;
|
int datasize;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
ShowAction ("Saving prefs to SD...");
|
ShowAction ((char*) "Saving prefs to SD...");
|
||||||
|
|
||||||
#ifdef SDUSE_LFN
|
#ifdef SDUSE_LFN
|
||||||
sprintf (filepath, "dev%d:\\%s\\%s", slot, SNESSAVEDIR, PREFS_FILE_NAME);
|
sprintf (filepath, "%s/%s/%s", rootSDdir, SNESSAVEDIR, PREFS_FILE_NAME);
|
||||||
#else
|
#else
|
||||||
sprintf (filepath, "dev%d:\\SNESSAVE\\%s", slot, PREFS_FILE_NAME);
|
sprintf (filepath, "%s/%s/%s", rootSDdir, SNESSAVEDIR, PREFS_FILE_NAME);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
datasize = preparePrefsData ();
|
datasize = preparePrefsData ();
|
||||||
@ -418,19 +420,17 @@ SavePrefsToSD (uint8 slot, bool8 silent)
|
|||||||
* Load Preferences from SD Card
|
* Load Preferences from SD Card
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void
|
void
|
||||||
LoadPrefsFromSD (uint8 slot, bool8 silent)
|
LoadPrefsFromSD (int slot, bool silent)
|
||||||
{
|
{
|
||||||
char filepath[1024];
|
char filepath[1024];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
ShowAction ("Loading prefs from SD...");
|
ShowAction ((char*) "Loading prefs from SD...");
|
||||||
|
|
||||||
#ifdef SDUSE_LFN
|
#ifdef SDUSE_LFN
|
||||||
sprintf (filepath, "dev%d:\\%s\\%s", slot, SNESSAVEDIR, PREFS_FILE_NAME);
|
sprintf (filepath, "%s/%s/%s", rootSDdir, SNESSAVEDIR, PREFS_FILE_NAME);
|
||||||
// sprintf (filepath, "dev%d:\\%s.srm", Memory.ROMName);
|
|
||||||
#else
|
#else
|
||||||
sprintf (filepath, "dev%d:\\SNESSAVE\\%s", slot, PREFS_FILE_NAME);
|
sprintf (filepath, "%s/%s/%s", rootSDdir, SNESSAVEDIR, PREFS_FILE_NAME);
|
||||||
// sprintf (filepath, "dev0:\\%08x.srm", Memory.ROMCRC32);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
offset = LoadBufferFromSD (filepath, silent);
|
offset = LoadBufferFromSD (filepath, silent);
|
||||||
|
@ -12,16 +12,24 @@
|
|||||||
|
|
||||||
#ifndef _LOADFROMSDC_
|
#ifndef _LOADFROMSDC_
|
||||||
#define _LOADFROMSDC_
|
#define _LOADFROMSDC_
|
||||||
#include <sdcard.h>
|
#include <gccore.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ogcsys.h>
|
||||||
|
#include <fat.h>
|
||||||
|
#include <sys/dir.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
int updateSDdirname();
|
int updateSDdirname();
|
||||||
int parseSDdirectory();
|
int parseSDdirectory();
|
||||||
int LoadSDFile (char *filename, int length);
|
int LoadSDFile (char *filename, int length);
|
||||||
void SaveSRAMToSD (uint8 slot, bool8 silent);
|
void SaveSRAMToSD (int slot, bool silent);
|
||||||
void LoadSRAMFromSD (uint8 slot, bool8 silent);
|
void LoadSRAMFromSD (int slot, bool silent);
|
||||||
void SavePrefsToSD (uint8 slot, bool8 silent);
|
void SavePrefsToSD (int slot, bool silent);
|
||||||
void LoadPrefsFromSD (uint8 slot, bool8 silent);
|
void LoadPrefsFromSD (int slot, bool silent);
|
||||||
|
|
||||||
extern char rootSDdir[SDCARD_MAX_PATH_LEN];
|
extern char rootSDdir[MAXPATHLEN];
|
||||||
|
extern char currSDdir[MAXPATHLEN];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,6 +44,8 @@ SMBINFO smbinfo =
|
|||||||
SMB_USER, SMB_PWD, SMB_GCID, SMB_SVID, SMB_SHARE
|
SMB_USER, SMB_PWD, SMB_GCID, SMB_SVID, SMB_SHARE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern FILEENTRIES filelist[MAXFILES];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Mount SMB Share
|
* Mount SMB Share
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -63,19 +65,19 @@ ConnectSMB ()
|
|||||||
|
|
||||||
if (netinited == 0)
|
if (netinited == 0)
|
||||||
{
|
{
|
||||||
ShowAction ("Setting up network interface ...");
|
ShowAction ((char*) "Setting up network interface ...");
|
||||||
ret = if_config (smbinfo.gcip, smbinfo.gwip, smbinfo.mask, 0);
|
ret = if_config (smbinfo.gcip, smbinfo.gwip, smbinfo.mask, 0);
|
||||||
netinited = 1;
|
netinited = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowAction ("Connecting to share ...");
|
ShowAction ((char*) "Connecting to share ...");
|
||||||
SMB_Destroy ();
|
SMB_Destroy ();
|
||||||
|
|
||||||
if (SMB_Init (smbinfo.smbuser, smbinfo.smbpwd,
|
if (SMB_Init (smbinfo.smbuser, smbinfo.smbpwd,
|
||||||
smbinfo.smbgcid, smbinfo.smbsvid, smbinfo.smbshare,
|
smbinfo.smbgcid, smbinfo.smbsvid, smbinfo.smbshare,
|
||||||
smbinfo.smbip) != SMB_SUCCESS)
|
smbinfo.smbip) != SMB_SUCCESS)
|
||||||
{
|
{
|
||||||
WaitPrompt ("Failed to connect to SMB share");
|
WaitPrompt((char*) "Failed to connect to SMB share");
|
||||||
connected = 0;
|
connected = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -264,7 +266,7 @@ LoadSMBFile (char *filename, int length)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WaitPrompt ("SMB Reading Failed!");
|
WaitPrompt((char*) "SMB Reading Failed!");
|
||||||
//while (1);
|
//while (1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -380,7 +382,7 @@ SaveSRAMToSMB (bool8 silent)
|
|||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMName);
|
sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMName);
|
||||||
ShowAction ("Saving SRAM to SMB...");
|
ShowAction ((char*) "Saving SRAM to SMB...");
|
||||||
|
|
||||||
datasize = prepareEXPORTsavedata ();
|
datasize = prepareEXPORTsavedata ();
|
||||||
|
|
||||||
@ -406,7 +408,7 @@ LoadSRAMFromSMB (bool8 silent)
|
|||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMName);
|
sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMName);
|
||||||
ShowAction ("Loading SRAM from SMB...");
|
ShowAction ((char*) "Loading SRAM from SMB...");
|
||||||
|
|
||||||
offset = LoadBufferFromSMB (filepath, silent);
|
offset = LoadBufferFromSMB (filepath, silent);
|
||||||
|
|
||||||
@ -434,7 +436,7 @@ SavePrefsToSMB (bool8 silent)
|
|||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
sprintf (filepath, "%s\\%s", SNESSAVEDIR, PREFS_FILE_NAME);
|
sprintf (filepath, "%s\\%s", SNESSAVEDIR, PREFS_FILE_NAME);
|
||||||
ShowAction ("Saving preferences to SMB...");
|
ShowAction ((char*) "Saving preferences to SMB...");
|
||||||
|
|
||||||
datasize = preparePrefsData ();
|
datasize = preparePrefsData ();
|
||||||
|
|
||||||
@ -460,7 +462,7 @@ LoadPrefsFromSMB (bool8 silent)
|
|||||||
char filepath[1024];
|
char filepath[1024];
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
ShowAction ("Loading preferences from SMB...");
|
ShowAction ((char*) "Loading preferences from SMB...");
|
||||||
|
|
||||||
sprintf (filepath, "%s\\%s", SNESSAVEDIR, PREFS_FILE_NAME);
|
sprintf (filepath, "%s\\%s", SNESSAVEDIR, PREFS_FILE_NAME);
|
||||||
|
|
||||||
|
@ -157,6 +157,14 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <ogcsys.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fat.h>
|
||||||
|
#include <wiiuse/wpad.h>
|
||||||
|
#include <sdcard/card_cmn.h>
|
||||||
|
#include <sdcard/wiisd_io.h>
|
||||||
|
#include <sdcard/card_io.h>
|
||||||
|
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@ -186,7 +194,7 @@ unsigned long ARAM_ROMSIZE = 0;
|
|||||||
int ConfigRequested = 0;
|
int ConfigRequested = 0;
|
||||||
extern int FrameTimer;
|
extern int FrameTimer;
|
||||||
|
|
||||||
extern tb_t prev;
|
extern long long prev;
|
||||||
extern unsigned int timediffallowed;
|
extern unsigned int timediffallowed;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -209,6 +217,13 @@ unsigned short gcpadmap[] = { PAD_BUTTON_A, PAD_BUTTON_B,
|
|||||||
PAD_BUTTON_UP, PAD_BUTTON_DOWN,
|
PAD_BUTTON_UP, PAD_BUTTON_DOWN,
|
||||||
PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT
|
PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT
|
||||||
};
|
};
|
||||||
|
unsigned short wmpadmap[] = { WPAD_BUTTON_B, WPAD_BUTTON_2,
|
||||||
|
WPAD_BUTTON_1, WPAD_BUTTON_A,
|
||||||
|
0x0000, 0x0000,
|
||||||
|
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
|
||||||
|
WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT,
|
||||||
|
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN
|
||||||
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -260,13 +275,15 @@ decodepad (int pad)
|
|||||||
{
|
{
|
||||||
int i, offset;
|
int i, offset;
|
||||||
signed char x, y;
|
signed char x, y;
|
||||||
unsigned short jp;
|
//unsigned short jp, wp; //
|
||||||
|
u16 jp, wp;
|
||||||
float t;
|
float t;
|
||||||
|
|
||||||
/*** Do analogue updates ***/
|
/*** Do analogue updates ***/
|
||||||
x = PAD_StickX (pad);
|
x = PAD_StickX (pad);
|
||||||
y = PAD_StickY (pad);
|
y = PAD_StickY (pad);
|
||||||
jp = PAD_ButtonsHeld (pad);
|
jp = PAD_ButtonsHeld (pad);
|
||||||
|
wp = WPAD_ButtonsHeld (pad); // wiimote
|
||||||
|
|
||||||
/*** Is XY inside the "zone"? ***/
|
/*** Is XY inside the "zone"? ***/
|
||||||
if (x * x + y * y > padcal * padcal)
|
if (x * x + y * y > padcal * padcal)
|
||||||
@ -316,6 +333,10 @@ decodepad (int pad)
|
|||||||
S9xReportButton (offset + i, true);
|
S9xReportButton (offset + i, true);
|
||||||
else
|
else
|
||||||
S9xReportButton (offset + i, false);
|
S9xReportButton (offset + i, false);
|
||||||
|
if (wp & wmpadmap[i]) // wiimote
|
||||||
|
S9xReportButton (offset + i, true); //
|
||||||
|
else //
|
||||||
|
S9xReportButton (offset + i, false); //
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -327,28 +348,31 @@ decodepad (int pad)
|
|||||||
void
|
void
|
||||||
NGCReportButtons ()
|
NGCReportButtons ()
|
||||||
{
|
{
|
||||||
s8 px = PAD_SubStickX (0);
|
s8 gc_px = PAD_SubStickX (0);
|
||||||
s8 py = PAD_SubStickY (0);
|
s8 gc_py = PAD_SubStickY (0);
|
||||||
u16 pb = PAD_ButtonsHeld (0);
|
u16 gc_pb = PAD_ButtonsHeld (0);
|
||||||
|
u16 wm_pb = WPAD_ButtonsHeld (0); // wiimote
|
||||||
|
|
||||||
/*** Check for video zoom ***/
|
/*** Check for video zoom ***/
|
||||||
if (GCSettings.NGCZoom)
|
if (GCSettings.NGCZoom)
|
||||||
{
|
{
|
||||||
if (py < -18 || py > 18)
|
if (gc_py < -18 || gc_py > 18)
|
||||||
zoom ((float) py / -18);
|
zoom ((float) gc_py / -18);
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings.TurboMode = (px > 70);
|
Settings.TurboMode = (gc_px > 70);
|
||||||
|
|
||||||
/*** Check for menu:
|
/*** Check for menu:
|
||||||
CStick left
|
CStick left
|
||||||
OR "L+R+X+Y" (eg. Hombrew/Adapted SNES controllers) ***/
|
OR "L+R+X+Y" (eg. Hombrew/Adapted SNES controllers)
|
||||||
|
OR "Home" on the wiimote ***/
|
||||||
|
|
||||||
if ((px < -70) ||
|
if ((gc_px < -70) ||
|
||||||
((pb & PAD_TRIGGER_L) &&
|
((gc_pb & PAD_TRIGGER_L) &&
|
||||||
(pb & PAD_TRIGGER_R ) &&
|
(gc_pb & PAD_TRIGGER_R ) &&
|
||||||
(pb & PAD_BUTTON_X) &&
|
(gc_pb & PAD_BUTTON_X) &&
|
||||||
(pb & PAD_BUTTON_Y ))
|
(gc_pb & PAD_BUTTON_Y )) ||
|
||||||
|
(wm_pb & WPAD_BUTTON_HOME) // wiimote
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ConfigRequested = 1;
|
ConfigRequested = 1;
|
||||||
@ -357,17 +381,17 @@ NGCReportButtons ()
|
|||||||
|
|
||||||
if ( GCSettings.AutoSave == 1 )
|
if ( GCSettings.AutoSave == 1 )
|
||||||
{
|
{
|
||||||
if ( WaitPromptChoice ("Save SRAM?", "Don't Save", "Save") )
|
if ( WaitPromptChoice ((char*)"Save SRAM?", (char*)"Don't Save", (char*)"Save") )
|
||||||
quickSaveSRAM ( SILENT );
|
quickSaveSRAM ( SILENT );
|
||||||
}
|
}
|
||||||
else if ( GCSettings.AutoSave == 2 )
|
else if ( GCSettings.AutoSave == 2 )
|
||||||
{
|
{
|
||||||
if ( WaitPromptChoice ("Save Freeze State?", "Don't Save", "Save") )
|
if ( WaitPromptChoice ((char*)"Save Freeze State?", (char*)"Don't Save", (char*)"Save") )
|
||||||
quickSaveFreeze ( SILENT );
|
quickSaveFreeze ( SILENT );
|
||||||
}
|
}
|
||||||
else if ( GCSettings.AutoSave == 3 )
|
else if ( GCSettings.AutoSave == 3 )
|
||||||
{
|
{
|
||||||
if ( WaitPromptChoice ("Save SRAM and Freeze State?", "Don't Save", "Save") )
|
if ( WaitPromptChoice ((char*)"Save SRAM and Freeze State?", (char*)"Don't Save", (char*)"Save") )
|
||||||
{
|
{
|
||||||
quickSaveSRAM ( SILENT );
|
quickSaveSRAM ( SILENT );
|
||||||
quickSaveFreeze ( SILENT );
|
quickSaveFreeze ( SILENT );
|
||||||
@ -476,21 +500,40 @@ SetDefaultButtonMap ()
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* Eke-Eke: initialize frame Sync */
|
/* Eke-Eke: initialize frame Sync */
|
||||||
extern void S9xInitSync();
|
extern void S9xInitSync();
|
||||||
|
extern u8 vmode_60hz;
|
||||||
|
int timerstyle;
|
||||||
|
|
||||||
void
|
void
|
||||||
emulate ()
|
emulate ()
|
||||||
{
|
{
|
||||||
|
|
||||||
S9xSetSoundMute (TRUE);
|
S9xSetSoundMute (TRUE);
|
||||||
// FrameTimer = 0;
|
AudioStart ();
|
||||||
AudioStart ();
|
S9xInitSync();
|
||||||
S9xInitSync();
|
|
||||||
|
/*
|
||||||
|
Set frametimer method
|
||||||
|
(timerstyle: 0=NTSC vblank, 1=PAL int timer)
|
||||||
|
*/
|
||||||
|
if ( Settings.PAL ) {
|
||||||
|
if(vmode_60hz == 1)
|
||||||
|
timerstyle = 1;
|
||||||
|
else
|
||||||
|
timerstyle = 0;
|
||||||
|
//timediffallowed = Settings.FrameTimePAL;
|
||||||
|
} else {
|
||||||
|
if(vmode_60hz == 1)
|
||||||
|
timerstyle = 0;
|
||||||
|
else
|
||||||
|
timerstyle = 1;
|
||||||
|
//timediffallowed = Settings.FrameTimeNTSC;
|
||||||
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
S9xMainLoop ();
|
S9xMainLoop ();
|
||||||
NGCReportButtons ();
|
NGCReportButtons ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -521,6 +564,15 @@ main ()
|
|||||||
/*** Initialise GC ***/
|
/*** Initialise GC ***/
|
||||||
InitGCVideo (); /*** Get the ball rolling ***/
|
InitGCVideo (); /*** Get the ball rolling ***/
|
||||||
|
|
||||||
|
/*** Initialize libFAT and SD cards ***/
|
||||||
|
fatInitDefault();
|
||||||
|
//sdio_Startup(); // wii front sd
|
||||||
|
//sdgecko_initIODefault(); // sd gecko
|
||||||
|
|
||||||
|
|
||||||
|
/*** Initialize DVD subsystem ***/
|
||||||
|
DVD_Init ();
|
||||||
|
|
||||||
#ifdef FORCE_WII
|
#ifdef FORCE_WII
|
||||||
isWii = TRUE;
|
isWii = TRUE;
|
||||||
#else
|
#else
|
||||||
@ -530,6 +582,9 @@ main ()
|
|||||||
else
|
else
|
||||||
isWii = TRUE;
|
isWii = TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
WPAD_Init();
|
||||||
|
|
||||||
|
|
||||||
/*** Initialise freetype ***/
|
/*** Initialise freetype ***/
|
||||||
if (FT_Init ())
|
if (FT_Init ())
|
||||||
@ -537,6 +592,7 @@ main ()
|
|||||||
printf ("Cannot initialise font subsystem!\n");
|
printf ("Cannot initialise font subsystem!\n");
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
setfontsize (16);/***sets the font size.***/
|
||||||
|
|
||||||
/*** Set defaults ***/
|
/*** Set defaults ***/
|
||||||
DefaultSettings ();
|
DefaultSettings ();
|
||||||
@ -596,12 +652,8 @@ main ()
|
|||||||
|
|
||||||
/*** Load SRAM ***/
|
/*** Load SRAM ***/
|
||||||
Memory.LoadSRAM ("DVD");
|
Memory.LoadSRAM ("DVD");
|
||||||
|
|
||||||
if ( GCSettings.AutoLoad == 1 )
|
|
||||||
quickLoadSRAM ( SILENT );
|
|
||||||
else if ( GCSettings.AutoLoad == 2 )
|
|
||||||
quickLoadFreeze ( SILENT );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Emulate ***/
|
/*** Emulate ***/
|
||||||
emulate ();
|
emulate ();
|
||||||
|
|
||||||
|
@ -201,17 +201,6 @@ END_EXTERN_C
|
|||||||
#define QUICK_SAVE_SLOT 1
|
#define QUICK_SAVE_SLOT 1
|
||||||
#endif
|
#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 ***/
|
/*** default SMB settings ***/
|
||||||
#ifndef GC_IP
|
#ifndef GC_IP
|
||||||
#define GC_IP "192.168.1.32" /*** IP to assign the GameCube ***/
|
#define GC_IP "192.168.1.32" /*** IP to assign the GameCube ***/
|
||||||
|
@ -173,7 +173,7 @@ decodesavedata (int readsize)
|
|||||||
|
|
||||||
if ( strncmp (sramcomment, "Snes9x GX 2.0", 13) == 0 )
|
if ( strncmp (sramcomment, "Snes9x GX 2.0", 13) == 0 )
|
||||||
{
|
{
|
||||||
//WaitPrompt ("Memory Card format save");
|
//WaitPrompt((char*) "Memory Card format save");
|
||||||
offset += 64;
|
offset += 64;
|
||||||
memcpy (&size, savebuffer + offset, 4);
|
memcpy (&size, savebuffer + offset, 4);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <wiiuse/wpad.h>
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
//#include "debug.h"
|
//#include "debug.h"
|
||||||
@ -40,7 +42,7 @@ extern unsigned int SMBTimer;
|
|||||||
unsigned int *xfb[2] = { NULL, NULL }; /*** Double buffered ***/
|
unsigned int *xfb[2] = { NULL, NULL }; /*** Double buffered ***/
|
||||||
int whichfb = 0; /*** Switch ***/
|
int whichfb = 0; /*** Switch ***/
|
||||||
GXRModeObj *vmode; /*** General video mode ***/
|
GXRModeObj *vmode; /*** General video mode ***/
|
||||||
int screenheight = 480;
|
int screenheight;
|
||||||
|
|
||||||
/*** GX ***/
|
/*** GX ***/
|
||||||
#define TEX_WIDTH 512
|
#define TEX_WIDTH 512
|
||||||
@ -55,6 +57,8 @@ int vwidth, vheight, oldvwidth, oldvheight;
|
|||||||
|
|
||||||
u32 FrameTimer = 0;
|
u32 FrameTimer = 0;
|
||||||
|
|
||||||
|
u8 vmode_60hz = 0;
|
||||||
|
|
||||||
#define HASPECT 76
|
#define HASPECT 76
|
||||||
#define VASPECT 54
|
#define VASPECT 54
|
||||||
|
|
||||||
@ -258,6 +262,17 @@ StartGX ()
|
|||||||
vheight = 100;
|
vheight = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* UpdatePads
|
||||||
|
*
|
||||||
|
* called by postRetraceCallback in InitGCVideo - scans gcpad and wpad
|
||||||
|
****************************************************************************/
|
||||||
|
void UpdatePadsCB()
|
||||||
|
{
|
||||||
|
WPAD_ScanPads();
|
||||||
|
PAD_ScanPads();
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* InitGCVideo
|
* InitGCVideo
|
||||||
*
|
*
|
||||||
@ -276,7 +291,7 @@ InitGCVideo ()
|
|||||||
|
|
||||||
VIDEO_Init ();
|
VIDEO_Init ();
|
||||||
PAD_Init ();
|
PAD_Init ();
|
||||||
DVD_Init ();
|
//DVD_Init ();
|
||||||
|
|
||||||
/*** Check to see if this is a GC or a Wii ***/
|
/*** Check to see if this is a GC or a Wii ***/
|
||||||
// int driveid = dvd_driveid();
|
// int driveid = dvd_driveid();
|
||||||
@ -293,10 +308,31 @@ InitGCVideo ()
|
|||||||
ARAMPut ((char *) romptr, (char *) AR_SNESROM, ARAM_ROMSIZE);
|
ARAMPut ((char *) romptr, (char *) AR_SNESROM, ARAM_ROMSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Always use NTSC mode - this works on NTSC and PAL, GC and Wii
|
* Always use NTSC mode - this works on NTSC and PAL, GC and Wii
|
||||||
*/
|
vmode = &TVNtsc480IntDf;
|
||||||
vmode = &TVNtsc480IntDf;
|
*/
|
||||||
|
|
||||||
|
vmode = VIDEO_GetPreferredMode(NULL);
|
||||||
|
|
||||||
|
switch(vmode->viTVMode)
|
||||||
|
{
|
||||||
|
case VI_TVMODE_PAL_DS:
|
||||||
|
case VI_TVMODE_PAL_INT:
|
||||||
|
vmode_60hz = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VI_TVMODE_EURGB60_PROG:
|
||||||
|
case VI_TVMODE_EURGB60_DS:
|
||||||
|
case VI_TVMODE_NTSC_DS:
|
||||||
|
case VI_TVMODE_NTSC_INT:
|
||||||
|
case VI_TVMODE_NTSC_PROG:
|
||||||
|
case VI_TVMODE_MPAL_INT:
|
||||||
|
default:
|
||||||
|
vmode_60hz = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
VIDEO_Configure (vmode);
|
VIDEO_Configure (vmode);
|
||||||
|
|
||||||
screenheight = vmode->xfbHeight;
|
screenheight = vmode->xfbHeight;
|
||||||
@ -304,14 +340,13 @@ InitGCVideo ()
|
|||||||
/*
|
/*
|
||||||
* Allocate the video buffers
|
* Allocate the video buffers
|
||||||
*/
|
*/
|
||||||
xfb[0] = (unsigned int *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||||
xfb[1] = (unsigned int *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A console is always useful while debugging.
|
* A console is always useful while debugging.
|
||||||
*/
|
*/
|
||||||
console_init (xfb[0], 20, 64, vmode->fbWidth, vmode->xfbHeight,
|
console_init (xfb[0], 20, 64, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * 2);
|
||||||
vmode->fbWidth * 2);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear framebuffers etc.
|
* Clear framebuffers etc.
|
||||||
@ -323,15 +358,15 @@ InitGCVideo ()
|
|||||||
/*
|
/*
|
||||||
* Let libogc populate manage the PADs for us
|
* Let libogc populate manage the PADs for us
|
||||||
*/
|
*/
|
||||||
VIDEO_SetPostRetraceCallback (PAD_ScanPads);
|
//VIDEO_SetPostRetraceCallback ((VIRetraceCallback)PAD_ScanPads);
|
||||||
VIDEO_SetPreRetraceCallback (copy_to_xfb);
|
VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB);
|
||||||
|
VIDEO_SetPreRetraceCallback ((VIRetraceCallback)copy_to_xfb);
|
||||||
VIDEO_SetBlack (FALSE);
|
VIDEO_SetBlack (FALSE);
|
||||||
VIDEO_Flush ();
|
VIDEO_Flush ();
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
if (vmode->viTVMode & VI_NON_INTERLACE)
|
if (vmode->viTVMode & VI_NON_INTERLACE)
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
// DVD_Init ();
|
|
||||||
copynow = GX_FALSE;
|
copynow = GX_FALSE;
|
||||||
StartGX ();
|
StartGX ();
|
||||||
|
|
||||||
@ -348,11 +383,11 @@ InitGCVideo ()
|
|||||||
* Drawing screen
|
* Drawing screen
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void
|
void
|
||||||
clearscreen ()
|
clearscreen (int colour)
|
||||||
{
|
{
|
||||||
whichfb ^= 1;
|
whichfb ^= 1;
|
||||||
ARAMFetch ((char *) xfb[whichfb], (char *) AR_BACKDROP,
|
//ARAMFetch ((char *) xfb[whichfb], (char *) AR_BACKDROP, 640 * screenheight * 2); // FIX
|
||||||
640 * screenheight * 2);
|
VIDEO_ClearFrameBuffer (vmode, xfb[whichfb], colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -11,13 +11,17 @@
|
|||||||
#ifndef _GCVIDEOH_
|
#ifndef _GCVIDEOH_
|
||||||
|
|
||||||
#define _GCVIDEOH_
|
#define _GCVIDEOH_
|
||||||
|
//#include <gccore.h>
|
||||||
|
#include <ogcsys.h>
|
||||||
|
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
|
|
||||||
void InitGCVideo ();
|
void InitGCVideo ();
|
||||||
void clearscreen ();
|
void clearscreen (int colour = COLOR_WHITE);
|
||||||
void showscreen ();
|
void showscreen ();
|
||||||
void setGFX ();
|
void setGFX ();
|
||||||
void update_video (int width, int height);
|
void update_video (int width, int height);
|
||||||
void zoom (float speed);
|
void zoom (float speed);
|
||||||
|
void UpdatePadsCB();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -141,6 +141,7 @@
|
|||||||
Nintendo Co., Limited and its subsidiary companies.
|
Nintendo Co., Limited and its subsidiary companies.
|
||||||
**********************************************************************************/
|
**********************************************************************************/
|
||||||
|
|
||||||
|
#define _GLOBALS_CPP
|
||||||
|
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
@ -168,7 +169,7 @@
|
|||||||
|
|
||||||
#include "spc7110.h"
|
#include "spc7110.h"
|
||||||
|
|
||||||
START_EXTERN_C
|
//START_EXTERN_C
|
||||||
char String[513];
|
char String[513];
|
||||||
|
|
||||||
struct Missing missing;
|
struct Missing missing;
|
||||||
@ -210,12 +211,12 @@ uint8 *RegRAM = NULL;
|
|||||||
|
|
||||||
CMemory Memory;
|
CMemory Memory;
|
||||||
|
|
||||||
struct SSNESGameFixes SNESGameFixes;
|
SSNESGameFixes SNESGameFixes;
|
||||||
|
|
||||||
unsigned char OpenBus = 0;
|
unsigned char OpenBus = 0;
|
||||||
|
|
||||||
|
|
||||||
END_EXTERN_C
|
//END_EXTERN_C
|
||||||
|
|
||||||
#ifndef ZSNES_FX
|
#ifndef ZSNES_FX
|
||||||
struct FxInit_s SuperFX;
|
struct FxInit_s SuperFX;
|
||||||
|
@ -409,9 +409,11 @@ typedef struct{
|
|||||||
uint8 _5A22;
|
uint8 _5A22;
|
||||||
} SnesModel;
|
} SnesModel;
|
||||||
|
|
||||||
|
#ifndef _GLOBALS_CPP
|
||||||
extern SnesModel* Model;
|
extern SnesModel* Model;
|
||||||
extern SnesModel M1SNES;
|
extern SnesModel M1SNES;
|
||||||
extern SnesModel M2SNES;
|
extern SnesModel M2SNES;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_5C77_VERSION 0x01
|
#define MAX_5C77_VERSION 0x01
|
||||||
#define MAX_5C78_VERSION 0x03
|
#define MAX_5C78_VERSION 0x03
|
||||||
|
Loading…
Reference in New Issue
Block a user