[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:
michniewski 2008-08-06 01:39:43 +00:00
parent ceacc3a72c
commit 6fb28b823a
21 changed files with 946 additions and 725 deletions

329
Makefile
View File

@ -1,181 +1,148 @@
#---------------------------------------------------------------------------------
# Generic makefile for Gamecube projects
#
# Tab stops set to 4
# | | | |
# 0 1 2 3
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := bin/snes9xgx-crunchy2-wii
BUILD := build
SOURCES := source/snes9x source/unzip source/ngc source/smb
INCLUDES := source/snes9x source/unzip source/ngc source/smb
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
-DNGC -DNO_ASM -DCPU_SHUTDOWN -DSPC700C \
-DSPC700_SHUTDOWN -DNEW_COLOUR_BLENDING \
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
-DQUICK_SAVE_SLOT=4 -DSMB_SVID='"Crunchewy"' \
-DSMB_IP='"192.168.1.111"' -DGW_IP='"192.168.1.1"'\
-DFORCE_WII=1 \
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
-pipe
LDFLAGS = $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map -Wl,--cref
PREFIX := powerpc-gekko-
#export PATH:=/c/devkitPPC_r11/bin:/bin
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS :=
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with
#---------------------------------------------------------------------------------
LIBS := -logc -lm -lz -logcsys -lfreetype -lbba -lsdcard
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
export CC := $(PREFIX)gcc
export CXX := $(PREFIX)g++
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
export LD := $(CC)
else
export LD := $(CXX)
endif
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
export OUTPUT := $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) *.elf
#---------------------------------------------------------------------------------
run:
psoload $(TARGET).dol
#---------------------------------------------------------------------------------
reload:
psoload -r $(TARGET).dol
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
@echo output ... $(notdir $@)
@$(OBJCOPY) -O binary $< $@
#---------------------------------------------------------------------------------
$(OUTPUT).elf: $(OFILES)
@echo linking ... $(notdir $@)
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
#---------------------------------------------------------------------------------
# Compile Targets for C/C++
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
%.o : %.cpp
@echo Compiling ... $(notdir $<)
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
#---------------------------------------------------------------------------------
%.o : %.c
@echo Compiling ... $(notdir $<)
@$(CC) -MMD $(CFLAGS) -o $@ -c $<
#---------------------------------------------------------------------------------
%.o : %.S
@echo Compiling ... $(notdir $<)
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
#---------------------------------------------------------------------------------
%.o : %.s
@echo Compiling ... $(notdir $<)
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
#---------------------------------------------------------------------------------
# canned command sequence for binary data
#---------------------------------------------------------------------------------
define bin2o
cp $(<) $(*).tmp
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
--rename-section .data=.rodata,readonly,data,contents,alloc \
--redefine-sym _binary_$*_tmp_start=$*\
--redefine-sym _binary_$*_tmp_end=$*_end\
--redefine-sym _binary_$*_tmp_size=$*_size\
$(*).tmp $(@)
echo "extern const u8" $(*)"[];" > $(*).h
echo "extern const u32" $(*)_size[]";" >> $(*).h
rm $(*).tmp
endef
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
# 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)/wii_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 := 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=3 -DSMB_SVID='"Crunchewy"' \
-DSMB_IP='"192.168.1.111"' -DGW_IP='"192.168.1.1"' -DFORCE_WII=1 \
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter -pipe
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
# -mogc
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lfat -lwiiuse -lz -lbte -logc -lm -lfreetype
# -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
#---------------------------------------------------------------------------------

148
Makefile.gc Normal file
View 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
#---------------------------------------------------------------------------------

View File

@ -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.
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
* Changed: SMB options no longer displayed in menus when run on a Wii
* 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:
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|
@ -307,7 +336,7 @@ TBD
GameCube Port 2.0 WIP6 and earlier - SoftDev
Additional improvements to 2.0 WIP6 - eke-eke
GameCube 2.0.1bx enhancements - crunchy2
>1.36 GB DVD reading on Wii - svpe
v001 updates - michniewski
GX - http://www.gc-linux.org
Font - Qoob Team
libogc - Shagkur

View File

@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wiiuse/wpad.h>
#include "snes9x.h"
#include "memmap.h"
@ -37,7 +38,7 @@
#include "mcsave.h"
#define PAGESIZE 17
static int maxfiles;
int maxfiles;
int havedir = 0;
int hasloaded = 0;
int loadtype = 0;
@ -45,7 +46,9 @@ int LoadDVDFile (unsigned char *buffer);
int haveSDdir = 0;
extern unsigned long ARAM_ROMSIZE;
extern int screenheight;
extern FILEENTRIES filelist[MAXFILES];
/**
* Showfile screen
*
@ -55,26 +58,31 @@ static void
ShowFiles (int offset, int selection)
{
int i, j;
char text[80];
char text[MAXPATHLEN];
int ypos;
int w;
setfontsize(18);
clearscreen ();
setfontsize (16);
ypos = (screenheight - ((PAGESIZE - 1) * 20)) >> 1;
if (screenheight == 480)
ypos += 24;
else
ypos += 10;
// show offset and selection at top
sprintf(text,"offset: %d, selection: %d",offset, selection);
DrawText (-1, 20, text);
j = 0;
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
{
if (filelist[i].flags)
if (filelist[i].flags) // if a dir
{
strcpy (text, "[");
@ -107,8 +115,6 @@ ShowFiles (int offset, int selection)
}
showscreen ();
setfontsize (24);
}
/**
@ -139,7 +145,7 @@ int selection = 0;
int
FileSelector ()
{
short p;
int p, wp;
signed char a;
int haverom = 0;
int redraw = 1;
@ -151,8 +157,9 @@ FileSelector ()
ShowFiles (offset, selection);
redraw = 0;
p = PAD_ButtonsDown (0);
wp = WPAD_ButtonsDown (0);
a = PAD_StickY (0);
if ((p & PAD_BUTTON_A) || selectit)
if ( (p & PAD_BUTTON_A) || (wp & WPAD_BUTTON_A) || selectit )
{
if ( selectit )
selectit = 0;
@ -165,17 +172,17 @@ FileSelector ()
/* update current directory and set new entry list if directory has changed */
int status = updateSDdirname();
if (status == 1)
if (status == 1) // ok, open directory
{
maxfiles = parseSDdirectory();
if (!maxfiles)
{
WaitPrompt ("Error reading directory !");
WaitPrompt ((char*) "Error reading directory !");
haverom = 1; // quit SD menu
haveSDdir = 0; // reset everything at next access
}
}
else if (status == -1)
else if (status == -1) // directory name too long
{
haverom = 1; // quit SD menu
haveSDdir = 0; // reset everything at next access
@ -195,7 +202,7 @@ FileSelector ()
}
}
}
else
else // this is a file
{
rootdir = filelist[selection].offset;
rootdirlength = filelist[selection].length;
@ -235,21 +242,29 @@ FileSelector ()
}
else
{
WaitPrompt("Error loading ROM!");
WaitPrompt((char*) "Error loading ROM!");
}
}
redraw = 1;
}
if ( p & PAD_BUTTON_B )
} // End of A
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();
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;
else
} else {
return 0;
}
if ((p & PAD_BUTTON_DOWN) || (a < -PADCAL))
}
} // End of B
if ( (p & PAD_BUTTON_DOWN) || (wp & WPAD_BUTTON_DOWN) || (a < -PADCAL) )
{
selection++;
if (selection == maxfiles)
@ -257,8 +272,8 @@ FileSelector ()
if ((selection - offset) >= PAGESIZE)
offset += PAGESIZE;
redraw = 1;
} // End of down
if ((p & PAD_BUTTON_UP) || (a > PADCAL))
} // End of down
if ( (p & PAD_BUTTON_UP) || (wp & WPAD_BUTTON_UP) || (a > PADCAL) )
{
selection--;
if (selection < 0)
@ -271,8 +286,8 @@ FileSelector ()
if (offset < 0)
offset = 0;
redraw = 1;
} // End of Up
if (PAD_ButtonsHeld (0) & PAD_BUTTON_LEFT)
} // End of Up
if ( (PAD_ButtonsHeld(0) & PAD_BUTTON_LEFT) || (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) )
{
/*** Go back a page ***/
selection -= PAGESIZE;
@ -287,7 +302,7 @@ FileSelector ()
offset = 0;
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 ***/
selection += PAGESIZE;
@ -315,7 +330,7 @@ OpenDVD ()
if (!getpvd())
{
ShowAction("Mounting DVD ... Wait");
ShowAction((char*) "Mounting DVD ... Wait");
DVD_Mount(); /* mount the DVD unit again */
havedir = 0; /* this may be a new DVD: content need to be parsed again */
if (!getpvd())
@ -378,19 +393,18 @@ int
OpenSD (int slot)
{
char msg[80];
char buf[50] = "";
loadtype = LOAD_SDC;
if (haveSDdir == 0)
{
/* don't mess with DVD entries */
havedir = 0;
havedir = 0; // gamecube only
/* Initialise libOGC SD functions */
SDCARD_Init ();
/* Reset SDCARD root directory */
sprintf(rootSDdir,"dev%d:\\SNESROMS", slot);
/* get current SDCARD directory */
sprintf ( currSDdir, getcwd(buf,50) ); // FIX: necessary?
/* Parse initial root directory and get entries list */
if ((maxfiles = parseSDdirectory ()))
@ -401,7 +415,7 @@ OpenSD (int slot)
else
{
/* 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);
return 0;
}
@ -440,7 +454,7 @@ LoadDVDFile (unsigned char *buffer)
blocks = rootdirlength / 2048;
offset = 0;
discoffset = rootdir;
ShowAction ("Loading ... Wait");
ShowAction ((char*) "Loading ... Wait");
dvd_read (readbuffer, 2048, discoffset);
if (!IsZipFile (readbuffer))

View File

@ -23,6 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <wiiuse/wpad.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include "video.h"
@ -75,6 +76,7 @@ FT_Init ()
return 1;
setfontsize (16);
setfontcolour (0xff, 0xff, 0xff);
slot = face->glyph;
@ -220,22 +222,23 @@ licence ()
else
ypos += 24;
setfontsize (16); // FIX
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 += 20, "redistribute it under the conditions of the");
DrawText (-1, ypos += 20, "GNU GENERAL PUBLIC LICENSE Version 2");
DrawText (-1, ypos += 40, (char*)"This is free software, and you are welcome to");
DrawText (-1, ypos += 20, (char*)"redistribute it under the conditions of the");
DrawText (-1, ypos += 20, (char*)"GNU GENERAL PUBLIC LICENSE Version 2");
DrawText (-1, ypos +=
20, "Additionally, the developers of this port disclaims");
20, (char*)"Additionally, the developers of this port disclaims");
DrawText (-1, ypos +=
20, "all copyright interests in the Nintendo GameCube");
20, (char*)"all copyright interests in the Nintendo GameCube");
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 += 20, "http://www.devkitpro.org");
DrawText (-1, ypos += 40, (char*)"Developed with DevkitPPC and libOGC");
DrawText (-1, ypos += 20, (char*)"http://www.devkitpro.org");
}
@ -377,8 +380,8 @@ legal ()
void
WaitButtonA ()
{
while (PAD_ButtonsDown (0) & PAD_BUTTON_A);
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) && !(WPAD_ButtonsDown(0) & WPAD_BUTTON_A) );
}
/**
@ -387,16 +390,17 @@ WaitButtonA ()
int
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 )
{
btns = PAD_ButtonsDown (0);
if ( btns & PAD_BUTTON_A )
gc_btns = PAD_ButtonsDown (0);
wm_btns = WPAD_ButtonsDown (0);
if ( (gc_btns & PAD_BUTTON_A) || (wm_btns & WPAD_BUTTON_A) )
return 1;
else if ( btns & PAD_BUTTON_B )
else if ( (gc_btns & PAD_BUTTON_B) || (wm_btns & WPAD_BUTTON_B) )
return 0;
}
}
@ -417,7 +421,7 @@ WaitPrompt (char *msg)
clearscreen ();
DrawText (-1, ypos, msg);
ypos += 30;
DrawText (-1, ypos, "Press A to continue");
DrawText (-1, ypos, (char*)"Press A to continue");
showscreen ();
WaitButtonA ();
}
@ -531,7 +535,7 @@ RunMenu (char items[][20], int maxitems, char *title)
{
int redraw = 1;
int quit = 0;
short p;
int p, wp;
int ret = 0;
signed char a;
@ -545,29 +549,30 @@ RunMenu (char items[][20], int maxitems, char *title)
}
p = PAD_ButtonsDown (0);
wp = WPAD_ButtonsDown (0);
a = PAD_StickY (0);
/*** Look for up ***/
if ((p & PAD_BUTTON_UP) || (a > 70))
if ((p & PAD_BUTTON_UP) || (wp & WPAD_BUTTON_UP) || (a > 70))
{
redraw = 1;
menu--;
}
/*** Look for down ***/
if ((p & PAD_BUTTON_DOWN) || (a < -70))
if ((p & PAD_BUTTON_DOWN) || (wp & WPAD_BUTTON_DOWN) || (a < -70))
{
redraw = 1;
menu++;
}
if (p & PAD_BUTTON_A)
if ((p & PAD_BUTTON_A) || (wp & WPAD_BUTTON_A))
{
quit = 1;
ret = menu;
}
if (p & PAD_BUTTON_B)
if ((p & PAD_BUTTON_B) || (wp & WPAD_BUTTON_B))
{
quit = -1;
ret = -1;
@ -580,10 +585,10 @@ RunMenu (char items[][20], int maxitems, char *title)
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 ***/
while (PAD_ButtonsDown (0) & PAD_BUTTON_B)
while ((PAD_ButtonsDown(0) & PAD_BUTTON_B) || (WPAD_ButtonsDown(0) & WPAD_BUTTON_B))
VIDEO_WaitVSync();
return -1;
}

View File

@ -2,20 +2,9 @@
* gctime.h
****************************************************************************/
#define mftb(rval) ({unsigned long u; do { \
asm volatile ("mftbu %0" : "=r" (u)); \
asm volatile ("mftb %0" : "=r" ((rval)->l)); \
asm volatile ("mftbu %0" : "=r" ((rval)->u)); \
} while(u != ((rval)->u)); })
typedef struct
{
unsigned long l, u;
} tb_t;
unsigned long tb_diff_msec(tb_t *end, tb_t *start);
unsigned long tb_diff_usec(tb_t *end, tb_t *start);
void udelay(unsigned int us);
void mdelay(unsigned int ms);
extern "C" {
long long gettime();
u32 diff_usec(long long start,long long end);
}

View File

@ -14,6 +14,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "snes9x.h"
#include "memmap.h"
@ -100,11 +101,11 @@ int MountCard(int cslot)
while ( tries < 3 && ret == CARD_ERROR_IOERROR )
{
if (cslot == CARD_SLOTA)
WaitPrompt("Replug card in slot A!");
WaitPrompt((char*) "Replug card in slot A!");
else
WaitPrompt("Replug card in slot B!");
WaitPrompt((char*) "Replug card in slot B!");
ShowAction("");
ShowAction ((char*) "");
ret = CARD_Mount (cslot, SysArea, NULL);
tries++;
}
@ -112,10 +113,10 @@ int MountCard(int cslot)
tries = 0;
while ( tries < 5 && ret == CARD_ERROR_NOCARD )
{
ShowAction("Mounting card...");
ShowAction ((char*) "Mounting card...");
CARD_Unmount (cslot);
usleep(500000); // wait half second
ShowAction("");
ShowAction ((char*) "");
usleep(500000); // wait half second
ret = CARD_Mount (cslot, SysArea, NULL);
tries++;
@ -124,9 +125,9 @@ int MountCard(int cslot)
tries = 0;
while ( tries < 5 && ret == CARD_ERROR_UNLOCKED )
{
ShowAction("Waiting for unlock...");
ShowAction ((char*) "Waiting for unlock...");
usleep(500000); // wait half second
ShowAction("");
ShowAction ((char*) "");
usleep(500000); // wait half second
ret = CARD_Probe(cslot);
tries++;
@ -164,7 +165,7 @@ VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize)
if (!CardFileExists (filename, slot))
{
CARD_Unmount (slot);
WaitPrompt ("Unable to open file for verify!");
WaitPrompt((char*) "Unable to open file for verify!");
return 0;
}
@ -192,7 +193,7 @@ VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize)
{
CARD_Close (&CardFile);
CARD_Unmount (slot);
WaitPrompt ("File did not verify!");
WaitPrompt((char*) "File did not verify!");
return 0;
}
@ -209,9 +210,9 @@ VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize)
}
else
if (slot == CARD_SLOTA)
WaitPrompt ("Unable to Mount Slot A Memory Card!");
WaitPrompt((char*) "Unable to Mount Slot A Memory Card!");
else
WaitPrompt ("Unable to Mount Slot B Memory Card!");
WaitPrompt((char*) "Unable to Mount Slot B Memory Card!");
return 0;
}
@ -245,7 +246,7 @@ LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent)
if (!CardFileExists (filename, slot))
{
if ( !silent )
WaitPrompt ("Unable to open file");
WaitPrompt((char*) "Unable to open file");
return 0;
}
@ -278,9 +279,9 @@ LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent)
}
else
if (slot == CARD_SLOTA)
WaitPrompt ("Unable to Mount Slot A Memory Card!");
WaitPrompt((char*) "Unable to Mount Slot A Memory Card!");
else
WaitPrompt ("Unable to Mount Slot B Memory Card!");
WaitPrompt((char*) "Unable to Mount Slot B Memory Card!");
return bytesread;
}
@ -324,7 +325,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
if (CardError)
{
CARD_Unmount (slot);
WaitPrompt ("Unable to open card file!");
WaitPrompt((char*) "Unable to open card file!");
return 0;
}
@ -337,7 +338,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
// if (CardError)
// {
// CARD_Unmount (slot);
// WaitPrompt ("Unable to delete existing file!");
// WaitPrompt((char*) "Unable to delete existing file!");
// return 0;
// }
//
@ -346,7 +347,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
// if (CardError)
// {
// CARD_Unmount (slot);
// WaitPrompt ("Unable to create updated card file!");
// WaitPrompt((char*) "Unable to create updated card file!");
// return 0;
// }
//
@ -362,7 +363,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
if (CardError)
{
CARD_Unmount (slot);
WaitPrompt ("Not enough space to update file!");
WaitPrompt((char*) "Not enough space to update file!");
return 0;
}
@ -372,7 +373,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
if (CardError)
{
CARD_Unmount (slot);
WaitPrompt ("Unable to delete temporary file!");
WaitPrompt((char*) "Unable to delete temporary file!");
return 0;
}
@ -381,7 +382,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
if (CardError)
{
CARD_Unmount (slot);
WaitPrompt ("Unable to delete existing file!");
WaitPrompt((char*) "Unable to delete existing file!");
return 0;
}
@ -390,7 +391,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
if (CardError)
{
CARD_Unmount (slot);
WaitPrompt ("Unable to create updated card file!");
WaitPrompt((char*) "Unable to create updated card file!");
return 0;
}
}
@ -403,9 +404,9 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
{
CARD_Unmount (slot);
if ( CardError = CARD_ERROR_INSSPACE )
WaitPrompt ("Not enough space to create file!");
WaitPrompt((char*) "Not enough space to create file!");
else
WaitPrompt ("Unable to create card file!");
WaitPrompt((char*) "Unable to create card file!");
return 0;
}
}
@ -449,13 +450,13 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
}
else
if ( !silent )
WaitPrompt ("This game does not appear to use SRAM");
WaitPrompt((char*) "This game does not appear to use SRAM");
}
else
if (slot == CARD_SLOTA)
WaitPrompt ("Unable to Mount Slot A Memory Card!");
WaitPrompt((char*) "Unable to Mount Slot A Memory Card!");
else
WaitPrompt ("Unable to Mount Slot B Memory Card!");
WaitPrompt((char*) "Unable to Mount Slot B Memory Card!");
return 0;
@ -469,7 +470,7 @@ LoadSRAMFromMC (int slot, int silent)
{
char filename[128];
ShowAction ("Loading SRAM from MC...");
ShowAction ((char*) "Loading SRAM from MC...");
/*** Build SRAM filename ***/
sprintf (filename, "%s.srm", Memory.ROMName);
@ -499,7 +500,7 @@ SaveSRAMToMC (int slot, int silent)
int datasize;
int offset;
ShowAction ("Saving SRAM to MC...");
ShowAction ((char*) "Saving SRAM to MC...");
/*** Build SRAM filename ***/
sprintf (filename, "%s.srm", Memory.ROMName);
@ -524,7 +525,7 @@ LoadPrefsFromMC (int slot, int silent)
int offset;
char msg[80];
ShowAction ("Loading Prefs from MC...");
ShowAction ((char*) "Loading Prefs from MC...");
offset = LoadBufferFromMC (savebuffer, slot, PREFS_FILE_NAME, silent);
@ -550,7 +551,7 @@ SavePrefsToMC (int slot, int silent)
int offset;
char msg[80];
ShowAction ("Saving Prefs to MC...");
ShowAction ((char*) "Saving Prefs to MC...");
datasize = preparePrefsData ();
offset = SaveBufferToMC (savebuffer, slot, PREFS_FILE_NAME, datasize, silent);

View File

@ -16,7 +16,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sdcard.h>
#include <fat.h>
#include <zlib.h>
#include "memfile.h"
@ -49,6 +49,8 @@ static char membuffer[MEMBUFFER];
char freezecomment[2][32] = { {"Snes9x GX 2.0.1b8 Freeze"}, {"Freeze"} };
extern char rootSDdir[MAXPATHLEN];
/**
* GetMem
@ -135,7 +137,7 @@ NGCFreezeGame (int where, bool8 silent)
{
char filename[1024];
SMBFILE smbfile;
sd_file *handle;
FILE *handle;
int len = 0;
int wrote = 0;
int offset = 0;
@ -144,18 +146,17 @@ NGCFreezeGame (int where, bool8 silent)
if (where == 4)
{
/*** 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)
{
/*** Freeze to SDCard in slot A or slot B ***/
SDCARD_Init ();
#ifdef SDUSE_LFN
sprintf (filename, "dev%d:\\%s\\%s.frz", where-2, SNESSAVEDIR, Memory.ROMName);
sprintf (filename, "%s/%s/%s.frz", rootSDdir, SNESSAVEDIR, Memory.ROMName);
#else
/*** 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
}
else
@ -181,7 +182,7 @@ NGCFreezeGame (int where, bool8 silent)
if (smbfile)
{
ShowAction ("Saving freeze game...");
ShowAction ((char*) "Saving freeze game...");
len = bufoffset;
offset = 0;
@ -217,17 +218,17 @@ NGCFreezeGame (int where, bool8 silent)
}
else if (where == 2 || where == 3) /*** SDCard slot A or slot B ***/
{
handle = SDCARD_OpenFile (filename, "wb");
handle = fopen (filename, "wb");
if (handle > 0)
{
ShowAction ("Saving freeze game...");
ShowAction ((char*) "Saving freeze game...");
len = SDCARD_WriteFile (handle, membuffer, bufoffset);
SDCARD_CloseFile (handle);
len = fwrite (membuffer, 1, bufoffset, handle);
fclose (handle);
if (len != bufoffset)
WaitPrompt ("Error writing freeze file");
WaitPrompt((char*) "Error writing freeze file");
else if ( !silent )
{
sprintf (filename, "Written %d bytes", bufoffset);
@ -237,13 +238,13 @@ NGCFreezeGame (int where, bool8 silent)
}
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);
}
}
else /*** MC in slot A or slot B ***/
{
ShowAction ("Saving freeze game...");
ShowAction ((char*) "Saving freeze game...");
ClearSaveBuffer ();
@ -333,7 +334,7 @@ NGCUnfreezeGame (int from, bool8 silent)
{
char filename[1024];
SMBFILE smbfile;
sd_file *handle;
FILE *handle;
int read = 0;
int offset = 0;
char msg[80];
@ -352,7 +353,7 @@ NGCUnfreezeGame (int from, bool8 silent)
if (smbfile)
{
ShowAction ("Loading freeze file...");
ShowAction ((char*) "Loading freeze file...");
while ((read =
SMB_Read ((char *) membuffer + offset, 1024, offset,
smbfile)) > 0)
@ -360,68 +361,67 @@ NGCUnfreezeGame (int from, bool8 silent)
SMB_Close (smbfile);
ShowAction ("Unpacking freeze file");
ShowAction ((char*) "Unpacking freeze file");
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
{
WaitPrompt ("Error thawing");
WaitPrompt((char*) "Error thawing");
return 0;
}
}
else if ( !silent )
{
WaitPrompt ("No freeze file found");
WaitPrompt((char*) "No freeze file found");
return 0;
}
}
else if (from == 2 || from == 3) /*** From SD slot A or slot B ***/
{
SDCARD_Init ();
#ifdef SDUSE_LFN
sprintf (filename, "dev%d:\\%s\\%s.frz", from-2, SNESSAVEDIR, Memory.ROMName);
sprintf (filename, "%s/%s/%s.frz", rootSDdir, SNESSAVEDIR, Memory.ROMName);
#else
/*** 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
handle = SDCARD_OpenFile (filename, "rb");
handle = fopen (filename, "rb");
if (handle > 0)
{
ShowAction ("Loading freeze file...");
ShowAction ((char*) "Loading freeze file...");
offset = 0;
/*** Usual chunks into memory ***/
while ((read = SDCARD_ReadFile (handle, membuffer + offset, 2048)) >
while ((read = fread (membuffer + offset, 1, 2048, handle)) >
0)
offset += read;
SDCARD_CloseFile (handle);
fclose (handle);
ShowAction ("Unpacking freeze file");
ShowAction ((char*) "Unpacking freeze file");
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
{
WaitPrompt ("Error thawing");
WaitPrompt((char*) "Error thawing");
return 0;
}
}
else if ( !silent )
{
WaitPrompt ("No freeze file found");
WaitPrompt((char*) "No freeze file found");
return 0;
}
}
else /*** From MC in slot A or slot B ***/
{
ShowAction ("Loading freeze file...");
ShowAction ((char*) "Loading freeze file...");
sprintf (filename, "%s.snz", Memory.ROMName);
int ret = LoadBufferFromMC ( savebuffer, from, filename, silent );
if ( ret )
{
ShowAction ("Unpacking freeze file");
ShowAction ((char*) "Unpacking freeze file");
// skip the saveicon and comment
offset = (sizeof(saveicon) + 64);
@ -448,13 +448,13 @@ NGCUnfreezeGame (int from, bool8 silent)
if ( DestBuffSize != decompressedsize )
{
WaitPrompt ("Unzipped size doesn't match expected size!");
WaitPrompt((char*) "Unzipped size doesn't match expected size!");
return 0;
}
if (S9xUnfreezeGame ("AGAME") != SUCCESS)
{
WaitPrompt ("Error thawing");
WaitPrompt((char*) "Error thawing");
return 0;
}
}

View File

@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wiiuse/wpad.h>
#include "snes9x.h"
#include "snes9xGx.h"
#include "memmap.h"
@ -46,21 +47,28 @@ extern unsigned long ARAM_ROMSIZE;
#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
****************************************************************************/
int freezecountwii = 9;
char freezemenuwii[][20] = { "Freeze to MC Slot A", "Thaw from MC Slot A",
int freezecountwii = 7;
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 SD Slot A", "Thaw from SD Slot A",
"Freeze to SD Slot B", "Thaw from SD Slot B",
"Return to previous"
};
int freezecount = 11;
char freezemenu[][20] = { "Freeze to MC Slot A", "Thaw from MC Slot A",
int freezecount = 9;
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 SD Slot A", "Thaw from SD Slot A",
"Freeze to SD Slot B", "Thaw from SD Slot B",
"Freeze to SMB", "Thaw from SMB",
"Return to previous"
};
@ -87,50 +95,42 @@ FreezeManager ()
switch (ret)
{
case 0:/*** Freeze to MC in slot A ***/
NGCFreezeGame (0, NOTSILENT);
break;
case 1:/*** Thaw from MC in slot A ***/
quit = loaded = NGCUnfreezeGame (0, NOTSILENT);
break;
case 2:/*** Freeze to MC in slot B ***/
NGCFreezeGame (1, NOTSILENT);
break;
case 3:/*** Thaw from MC in slot B ***/
quit = loaded = NGCUnfreezeGame (1, NOTSILENT);
break;
case 4:/*** Freeze to SDCard in slot A ***/
case 0:/*** Freeze to SDCard ***/
NGCFreezeGame (2, NOTSILENT);
break;
case 5:/*** Thaw from SDCard in slot A ***/
case 1:/*** Thaw from SDCard***/
quit = loaded = NGCUnfreezeGame (2, NOTSILENT);
break;
case 6:/*** Freeze to SDCard in slot B ***/
NGCFreezeGame (3, NOTSILENT);
case 2:/*** Freeze to MC in slot A ***/
NGCFreezeGame (0, NOTSILENT);
break;
case 7:/*** Thaw from SDCard in slot B ***/
quit = loaded = NGCUnfreezeGame (3, NOTSILENT);
case 3:/*** Thaw from MC in slot A ***/
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;
case 8:/*** Freeze to SMB ***/
case 6:/*** Freeze to SMB ***/
if ( !isWii )
NGCFreezeGame (4, NOTSILENT);
break;
case 9:/*** Thaw from SMB ***/
case 7:/*** Thaw from SMB ***/
if ( !isWii )
quit = loaded = NGCUnfreezeGame (4, NOTSILENT);
break;
case -1: /*** Button B ***/
case 10:
case 8:
quit = 1;
break;
}
@ -144,13 +144,13 @@ FreezeManager ()
/****************************************************************************
* Load Manager
****************************************************************************/
int loadmancountwii = 4;
char loadmanwii[][20] = { "Load from DVD", "Load from SD Slot A",
"Load from SD Slot B", "Return to previous"
int loadmancountwii = 2;
char loadmanwii[][20] = { "Load from SD",
"Return to previous"
};
int loadmancount = 5;
char loadman[][20] = { "Load from DVD", "Load from SD Slot A",
"Load from SD Slot B", "Load from SMB", "Return to previous"
int loadmancount = 4;
char loadman[][20] = { "Load from SD",
"Load from DVD", "Load from SMB", "Return to previous"
};
int
LoadManager ()
@ -158,67 +158,60 @@ LoadManager ()
int ret;
int quit = 0;
int oldmenu = menu;
int retval = 0;
int retval = 1;
menu = 0;
while (quit == 0)
{
if ( LOAD_TYPE )
ret = LOAD_TYPE-1;
else
{
if ( isWii ) /* Wii menu */
{
ret = RunMenu (loadmanwii, loadmancountwii, "Load Manager");
if (ret >= loadmancountwii-1)
ret = loadmancount-1;
}
else /* Gamecube menu */
ret = RunMenu (loadman, loadmancount, "Load Manager");
}
if ( isWii ) /* Wii menu */
{
ret = RunMenu (loadmanwii, loadmancountwii, (char*)"Load Manager");
if (ret >= loadmancountwii-1)
ret = loadmancount-1;
}
else /* Gamecube menu */
ret = RunMenu (loadman, loadmancount, (char*)"Load Manager");
switch (ret)
{
case 0:
/*** Load from DVD ***/
retval = OpenDVD ();
if ( LOAD_TYPE )
quit = 1;
else
quit = retval;
case 0:
/*** Load from SD ***/
quit = OpenSD (0);
break;
case 1:
retval = OpenSD (CARD_SLOTA);
if ( LOAD_TYPE )
quit = 1;
else
quit = retval;
/*** Load from DVD ***/
quit = OpenDVD ();
break;
case 2:
retval = OpenSD (CARD_SLOTB);
if ( LOAD_TYPE )
quit = 1;
else
quit = retval;
break;
case 3:
retval = OpenSMB ();
if ( LOAD_TYPE )
quit = 1;
else
quit = retval;
break;
/*** Load from SMB ***/ //(gamecube option)
quit = OpenSMB ();
break;
case -1: /*** Button B ***/
case 4:
case 3:
retval = 0;
quit = 1;
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;
return retval;
@ -227,18 +220,16 @@ LoadManager ()
/****************************************************************************
* Save Manager
****************************************************************************/
int savecountwii = 9;
char savemenuwii[][20] = { "Save to MC SLOT A", "Load from MC SLOT A",
int savecountwii = 7;
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 SD Slot A", "Load from SD Slot A",
"Save to SD Slot B", "Load from SD Slot B",
"Return to previous"
};
int savecount = 11;
char savemenu[][20] = { "Save to MC SLOT A", "Load from MC SLOT A",
int savecount = 9;
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 SD Slot A", "Load from SD Slot A",
"Save to SD Slot B", "Load from SD Slot B",
"Save to SMB", "Load from SMB",
"Return to previous"
};
@ -254,67 +245,57 @@ SaveManager ()
{
if ( isWii ) /* Wii menu */
{
ret = RunMenu (savemenuwii, savecountwii, "Save Manager");
ret = RunMenu (savemenuwii, savecountwii, (char*)"Save Manager");
if (ret >= savecountwii-1)
ret = savecount-1;
}
else /* Gamecube menu */
ret = RunMenu (savemenu, savecount, "Save Manager");
ret = RunMenu (savemenu, savecount, (char*)"Save Manager");
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 ***/
SaveSRAMToMC (CARD_SLOTA, NOTSILENT);
break;
case 1:
case 3:
/*** Load from MC slot A ***/
LoadSRAMFromMC (CARD_SLOTA, NOTSILENT);
break;
case 2:
case 4:
/*** Save to MC slot B ***/
SaveSRAMToMC (CARD_SLOTB, NOTSILENT);
break;
case 3:
case 5:
/*** Load from MC slot B ***/
LoadSRAMFromMC (CARD_SLOTB, NOTSILENT);
break;
case 4:
/*** Save to SD slot A ***/
SaveSRAMToSD (CARD_SLOTA, NOTSILENT);
break;
case 5:
/*** Load from SD slot A ***/
LoadSRAMFromSD (CARD_SLOTA, NOTSILENT);
break;
case 6:
/*** Save to SD slot B ***/
SaveSRAMToSD (CARD_SLOTB, NOTSILENT);
break;
case 7:
/*** Load from SD slot B ***/
LoadSRAMFromSD (CARD_SLOTB, NOTSILENT);
break;
case 8:
/*** Save to SMB **/
SaveSRAMToSMB (NOTSILENT);
break;
case 9:
case 7:
/*** Load from SMB ***/
LoadSRAMFromSMB (NOTSILENT);
break;
case -1: /*** Button B ***/
case 10:
case 8:
/*** Return ***/
quit = 1;
break;
@ -375,7 +356,7 @@ EmulatorOptions ()
sprintf (emulatorOptions[8], "Verify MC Saves %s",
GCSettings.VerifySaves == true ? " ON" : "OFF");
ret = RunMenu (emulatorOptions, emuCount, "Emulator Options");
ret = RunMenu (emulatorOptions, emuCount, (char*)"Emulator Options");
switch (ret)
{
@ -494,7 +475,7 @@ ConfigureJoyPads ()
sprintf (padmenu[4], "ANALOG CLIP - %d", padcal);
ret = RunMenu (padmenu, padcount, "Configure Joypads");
ret = RunMenu (padmenu, padcount, (char*)"Configure Joypads");
switch (ret)
{
@ -538,7 +519,7 @@ ConfigureJoyPads ()
if ( ARAM_ROMSIZE > 0 )
quickSaveSRAM(NOTSILENT);
else
WaitPrompt ("No ROM loaded - can't save SRAM");
WaitPrompt((char*) "No ROM loaded - can't save SRAM");
break;
@ -560,8 +541,8 @@ int menucount = 10;
char menuitems[][20] = { "Choose Game",
"SRAM Manager", "Freeze Manager",
"Configure Joypads", "Emulator Options",
"Reset Game", "Stop DVD Drive", "PSO Reload",
"Reset Gamecube", "Return to Game"
"Reset Game", "Stop DVD Drive", "Exit to Loader",
"Reboot System", "Return to Game"
};
void
@ -581,24 +562,13 @@ mainmenu ()
while (quit == 0)
{
ret = RunMenu (menuitems, menucount, "Main Menu");
ret = RunMenu (menuitems, menucount, (char*)"Main Menu");
switch (ret)
{
case 0:
/*** Load ROM Menu ***/
quit = LoadManager ();
if ( quit ) // if ROM was loaded, load the SRAM & settings
{
if ( GCSettings.AutoLoad == 1 )
quickLoadSRAM ( SILENT );
else if ( GCSettings.AutoLoad == 2 )
{
/*** load SRAM first in order to get joypad config ***/
quickLoadSRAM ( SILENT );
quickLoadFreeze ( SILENT );
}
}
break;
case 1:
@ -606,7 +576,7 @@ mainmenu ()
if ( ARAM_ROMSIZE > 0 )
SaveManager ();
else
WaitPrompt ("No ROM is loaded!");
WaitPrompt((char*) "No ROM is loaded!");
break;
case 2:
@ -614,7 +584,7 @@ mainmenu ()
if ( ARAM_ROMSIZE > 0 )
quit = FreezeManager ();
else
WaitPrompt ("No ROM is loaded!");
WaitPrompt((char*) "No ROM is loaded!");
break;
case 3:
@ -639,14 +609,18 @@ mainmenu ()
break;
case 7:
/*** PSO Reload ***/
/*** Exit to Loader ***/
#ifdef __wii__
exit(0);
#else // gamecube
if (psoid[0] == PSOSDLOADID)
PSOReload ();
#endif
break;
case 8:
/*** Reset the Gamecube ***/
*SOFTRESET_ADR = 0x00000000;
/*** Reset the Gamecube/Wii ***/
Reboot();
break;
case -1: /*** Button B ***/
@ -660,7 +634,7 @@ mainmenu ()
}
/*** Remove any still held buttons ***/
while( PAD_ButtonsHeld(0) )
while( PAD_ButtonsHeld(0) || WPAD_ButtonsHeld(0) )
VIDEO_WaitVSync();
}

View File

@ -40,7 +40,7 @@ preparePrefsData ()
int offset = sizeof (saveicon);
int size;
memset (savebuffer, 0, 0x22000);
memset (savebuffer, 0, SAVEBUFFERSIZE);
/*** Copy in save icon ***/
memcpy (savebuffer, saveicon, offset);
@ -83,7 +83,7 @@ decodePrefsData ()
memcpy (&GCSettings, savebuffer + offset, sizeof (GCSettings));
}
else
WaitPrompt("Preferences reset - check settings!");
WaitPrompt((char*) "Preferences reset - check settings!");
}
void quickLoadPrefs (bool8 silent)

View File

@ -158,6 +158,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "snes9x.h"
#include "memmap.h"
@ -180,8 +181,8 @@
extern u32 FrameTimer;
tb_t prev;
tb_t now;
long long prev;
long long now;
/*** Miscellaneous Functions ***/
@ -285,19 +286,20 @@ S9xGenerateSound ()
void S9xInitSync()
{
FrameTimer = 0;
mftb(&prev);
prev = gettime();
}
/*** Synchronisation ***/
void
S9xSyncSpeed ()
extern int timerstyle;
void S9xSyncSpeed ()
{
uint32 skipFrms = Settings.SkipFrames;
if ( Settings.TurboMode )
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)
{
@ -321,13 +323,12 @@ S9xSyncSpeed ()
else /* use internal timer for PAL roms */
{
unsigned int timediffallowed = Settings.TurboMode ? 0 : Settings.FrameTime;
mftb(&now);
now = gettime();
if (tb_diff_usec(&now, &prev) > timediffallowed)
if (diff_usec(prev, now) > timediffallowed)
{
/*while ( tb_diff_usec(&now, &prev) < timediffallowed * 2) {
mftb(&now);
/*while ( diff_usec((prev, now) < timediffallowed * 2) {
now = gettime();
}*/
/* Timer has already expired */
@ -345,12 +346,12 @@ S9xSyncSpeed ()
else
{
/*** 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.SkippedFrames = 0;
}
memcpy(&prev, &now, sizeof(tb_t));
prev = now;
}
if ( !Settings.TurboMode )

View File

@ -13,7 +13,7 @@
#include <stdio.h>
#include <string.h>
#include <ogcsys.h>
#include "sdcard.h"
#include "sdload.h"
#include "ngcunzip.h"
#include "memmap.h"
#include "video.h"
@ -26,10 +26,13 @@
#include <zlib.h>
extern unsigned char savebuffer[];
extern char output[16384];
char rootSDdir[SDCARD_MAX_PATH_LEN];
FILE * filehandle;
char rootSDdir[MAXPATHLEN] = "fat:/";
char currSDdir[MAXPATHLEN];
extern int offset;
extern int selection;
extern FILEENTRIES filelist[MAXFILES];
/***************************************************************************
* Update SDCARD curent directory name
@ -47,84 +50,85 @@ int updateSDdirname()
else if (strcmp(filelist[selection].filename,"..") == 0)
{
/* determine last subdirectory namelength */
sprintf(temp,"%s",rootSDdir);
test= strtok(temp,"\\");
while (test != NULL)
{
sprintf(temp,"%s",currSDdir);
test = strtok(temp,"/");
while (test != NULL) {
size = strlen(test);
test = strtok(NULL,"\\");
test = strtok(NULL,"/");
}
/* remove last subdirectory name */
size = strlen(rootSDdir) - size - 1;
rootSDdir[size] = 0;
size = strlen(currSDdir) - size - 1;
currSDdir[size] = 0;
/* handles root name */
if (strcmp(rootSDdir,"dev0:") == 0)
{
sprintf(rootSDdir,"dev0:\\SNESROMS");
return -1;
}
if (strcmp(currSDdir, "/") == 0)
return 1;
}
else
else /* Open a directory */
{
/* test new directory namelength */
if ((strlen(rootSDdir)+1+strlen(filelist[selection].filename)) < SDCARD_MAX_PATH_LEN)
{
/* handles root name */
if (strcmp(rootSDdir,"dev0:\\SNESROMS\\..") == 0) sprintf(rootSDdir,"dev0:");
if ((strlen(currSDdir)+1+strlen(filelist[selection].filename)) < MAXPATHLEN)
{
/* handles root name */
sprintf(temp, "/%s/..", SNESROMDIR);
if (strcmp(currSDdir, temp) == 0)
sprintf(currSDdir,"%s",rootSDdir);
/* update current directory name */
sprintf(rootSDdir, "%s\\%s",rootSDdir, filelist[selection].filename);
return 1;
}
else
{
WaitPrompt ("Dirname is too long !");
return -1;
}
/* update current directory name */
sprintf(currSDdir, "%s/%s",currSDdir, filelist[selection].filename);
return 1;
} else {
WaitPrompt((char*)"Dirname is too long !");
return -1;
}
}
}
/***************************************************************************
* Browse SDCARD subdirectories
***************************************************************************/
int parseSDdirectory()
{
int entries = 0;
int nbfiles = 0;
DIR *sddir = NULL;
char tname[1024];
offset = selection = 0;
/* Get a list of files from the actual root directory */
entries = SDCARD_ReadDir (rootSDdir, &sddir);
if (entries < 0) entries = 0;
if (entries > MAXFILES) entries = MAXFILES;
int parseSDdirectory() {
int nbfiles = 0;
DIR_ITER *sddir;
char filename[MAXPATHLEN];
struct stat filestat;
char msg[128];
/* initialize selection */
selection = offset = 0;
/* open the directory */
sddir = diropen(currSDdir);
if (sddir == NULL) {
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 */
while (entries)
{
memcpy (tname, &sddir[nbfiles].fname, 1024);
memset (&filelist[nbfiles], 0, sizeof (FILEENTRIES));
strncpy(filelist[nbfiles].filename,tname,MAXJOLIET+1);
filelist[nbfiles].filename[MAXJOLIET] = 0;
strncpy(filelist[nbfiles].displayname,tname,MAXDISPLAY+1);
filelist[nbfiles].filename[MAXDISPLAY] = 0;
filelist[nbfiles].length = sddir[nbfiles].fsize;
filelist[nbfiles].flags = (char)(sddir[nbfiles].fattr & SDCARD_ATTR_DIR);
nbfiles++;
entries--;
}
while(dirnext(sddir,filename,&filestat) == 0) {
if(strcmp(filename,".") != 0) {
memset(&filelist[nbfiles], 0, sizeof(FILEENTRIES));
strncpy(filelist[nbfiles].filename, filename, MAXPATHLEN);
strncpy(filelist[nbfiles].displayname, filename, MAXDISPLAY+1); // crop name for display
filelist[nbfiles].length = filestat.st_size;
filelist[nbfiles].flags = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1;
nbfiles++;
}
}
/*** Release memory ***/
free(sddir);
/*** close directory ***/
dirclose(sddir);
return nbfiles;
return nbfiles;
}
/****************************************************************************
@ -135,8 +139,8 @@ int
LoadSDFile (char *filename, int length)
{
char zipbuffer[2048];
char filepath[SDCARD_MAX_PATH_LEN];
sd_file *handle;
char filepath[MAXPATHLEN];
FILE *handle;
char *rbuffer;
PKZIPHEADER pkzip;
z_stream zs;
@ -147,100 +151,105 @@ LoadSDFile (char *filename, int length)
rbuffer = (char *) Memory.ROM;
/* Check filename length */
if ((strlen(rootSDdir)+1+strlen(filelist[selection].filename)) < SDCARD_MAX_PATH_LEN)
sprintf(filepath, "%s\\%s",rootSDdir,filelist[selection].filename);
if ((strlen(currSDdir)+1+strlen(filelist[selection].filename)) < MAXPATHLEN)
sprintf(filepath, "%s/%s",currSDdir,filelist[selection].filename);
else
{
WaitPrompt ("Maximum Filename Length reached !");
WaitPrompt((char*) "Maximum Filename Length reached !");
haveSDdir = 0; // reset everything before next access
return -1;
}
handle = SDCARD_OpenFile (filepath, "rb");
handle = fopen (filepath, "rb");
if (handle > 0)
{
SDCARD_ReadFile (handle, zipbuffer, 2048);
fread (zipbuffer, 1, 2048, handle);
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
if (IsZipFile (zipbuffer))
{
zs.avail_out = 16384;
zs.next_out = (Bytef *) output;
/*** 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 = inflate (&zs, Z_NO_FLUSH);
res = inflateInit2 (&zs, -MAX_WBITS);
have = 16384 - zs.avail_out;
if (have)
if (res != Z_OK)
{
memcpy (rbuffer + outbytes, output, have);
outbytes += have;
fclose (handle);
return 0;
}
size = (sizeof (PKZIPHEADER) +
FLIP16 (pkzip.filenameLength) +
FLIP16 (pkzip.extraDataLength));
do
{
zs.avail_in = 2048 - size;
zs.next_in = (Bytef *) zipbuffer + size;
do
{
zs.avail_out = 16384;
zs.next_out = (Bytef *) output;
res = inflate (&zs, Z_NO_FLUSH);
have = 16384 - zs.avail_out;
if (have)
{
memcpy (rbuffer + outbytes, output, have);
outbytes += have;
}
}
while (zs.avail_out == 0);
sprintf (filepath, "Read %d bytes of %d", outbytes,
pkzip.uncompressedSize);
//ShowAction (filepath);
ShowProgress (filepath, outbytes, pkzip.uncompressedSize);
size = 0;
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
{
WaitPrompt ("Error opening file");
WaitPrompt((char*) "Error opening file");
return 0;
}
@ -253,15 +262,13 @@ LoadSDFile (char *filename, int length)
* Load savebuffer from SD card file
****************************************************************************/
int
LoadBufferFromSD (char *filepath, bool8 silent)
LoadBufferFromSD (char *filepath, bool silent)
{
sd_file *handle;
FILE *handle;
int offset = 0;
int read = 0;
SDCARD_Init ();
handle = SDCARD_OpenFile (filepath, "rb");
handle = fopen (filepath, "rb");
if (handle <= 0)
{
@ -277,12 +284,12 @@ LoadBufferFromSD (char *filepath, bool8 silent)
memset (savebuffer, 0, 0x22000);
/*** 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;
}
SDCARD_CloseFile (handle);
fclose (handle);
return offset;
}
@ -292,15 +299,13 @@ LoadBufferFromSD (char *filepath, bool8 silent)
* Write savebuffer to SD card file
****************************************************************************/
int
SaveBufferToSD (char *filepath, int datasize, bool8 silent)
SaveBufferToSD (char *filepath, int datasize, bool silent)
{
sd_file *handle;
SDCARD_Init ();
FILE *handle;
if (datasize)
{
handle = SDCARD_OpenFile (filepath, "wb");
handle = fopen (filepath, "wb");
if (handle <= 0)
{
@ -310,8 +315,8 @@ SaveBufferToSD (char *filepath, int datasize, bool8 silent)
return 0;
}
SDCARD_WriteFile (handle, savebuffer, datasize);
SDCARD_CloseFile (handle);
fwrite (savebuffer, 1, datasize, handle);
fclose (handle);
}
return datasize;
@ -321,19 +326,18 @@ SaveBufferToSD (char *filepath, int datasize, bool8 silent)
/****************************************************************************
* Save SRAM to SD Card
****************************************************************************/
void
SaveSRAMToSD (uint8 slot, bool8 silent)
void SaveSRAMToSD (int slot, bool silent)
{
char filepath[1024];
int datasize;
int offset;
ShowAction ("Saving SRAM to SD...");
ShowAction ((char*) "Saving SRAM to SD...");
#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
sprintf (filepath, "dev%d:\\SNESSAVE\\%08x.srm", slot, Memory.ROMCRC32);
sprintf (filepath, "%s/SNESSAVE/%08x.srm", rootSDdir, Memory.ROMCRC32);
#endif
datasize = prepareEXPORTsavedata ();
@ -355,19 +359,17 @@ SaveSRAMToSD (uint8 slot, bool8 silent)
* Load SRAM From SD Card
****************************************************************************/
void
LoadSRAMFromSD (uint8 slot, bool8 silent)
LoadSRAMFromSD (int slot, bool silent)
{
char filepath[1024];
int offset = 0;
ShowAction ("Loading SRAM from SD...");
ShowAction ((char*) "Loading SRAM from SD...");
#ifdef SDUSE_LFN
sprintf (filepath, "dev%d:\\%s\\%s.srm", slot, SNESSAVEDIR, Memory.ROMName);
// sprintf (filepath, "dev%d:\\%s.srm", Memory.ROMName);
sprintf (filepath, "%s/%s/%s.srm", rootSDdir, SNESSAVEDIR, Memory.ROMName);
#else
sprintf (filepath, "dev%d:\\SNESSAVE\\%08x.srm", slot, Memory.ROMCRC32);
// sprintf (filepath, "dev0:\\%08x.srm", Memory.ROMCRC32);
sprintf (filepath, "%s/%s/%08x.srm", rootSDdir, SNESSAVEDIR, Memory.ROMCRC32);
#endif
offset = LoadBufferFromSD (filepath, silent);
@ -389,18 +391,18 @@ LoadSRAMFromSD (uint8 slot, bool8 silent)
* Save Preferences to SD Card
****************************************************************************/
void
SavePrefsToSD (uint8 slot, bool8 silent)
SavePrefsToSD (int slot, bool silent)
{
char filepath[1024];
int datasize;
int offset;
ShowAction ("Saving prefs to SD...");
ShowAction ((char*) "Saving prefs to SD...");
#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
sprintf (filepath, "dev%d:\\SNESSAVE\\%s", slot, PREFS_FILE_NAME);
sprintf (filepath, "%s/%s/%s", rootSDdir, SNESSAVEDIR, PREFS_FILE_NAME);
#endif
datasize = preparePrefsData ();
@ -418,19 +420,17 @@ SavePrefsToSD (uint8 slot, bool8 silent)
* Load Preferences from SD Card
****************************************************************************/
void
LoadPrefsFromSD (uint8 slot, bool8 silent)
LoadPrefsFromSD (int slot, bool silent)
{
char filepath[1024];
int offset = 0;
ShowAction ("Loading prefs from SD...");
ShowAction ((char*) "Loading prefs from SD...");
#ifdef SDUSE_LFN
sprintf (filepath, "dev%d:\\%s\\%s", slot, SNESSAVEDIR, PREFS_FILE_NAME);
// sprintf (filepath, "dev%d:\\%s.srm", Memory.ROMName);
sprintf (filepath, "%s/%s/%s", rootSDdir, SNESSAVEDIR, PREFS_FILE_NAME);
#else
sprintf (filepath, "dev%d:\\SNESSAVE\\%s", slot, PREFS_FILE_NAME);
// sprintf (filepath, "dev0:\\%08x.srm", Memory.ROMCRC32);
sprintf (filepath, "%s/%s/%s", rootSDdir, SNESSAVEDIR, PREFS_FILE_NAME);
#endif
offset = LoadBufferFromSD (filepath, silent);

View File

@ -12,16 +12,24 @@
#ifndef _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 parseSDdirectory();
int LoadSDFile (char *filename, int length);
void SaveSRAMToSD (uint8 slot, bool8 silent);
void LoadSRAMFromSD (uint8 slot, bool8 silent);
void SavePrefsToSD (uint8 slot, bool8 silent);
void LoadPrefsFromSD (uint8 slot, bool8 silent);
void SaveSRAMToSD (int slot, bool silent);
void LoadSRAMFromSD (int slot, bool silent);
void SavePrefsToSD (int slot, bool silent);
void LoadPrefsFromSD (int slot, bool silent);
extern char rootSDdir[SDCARD_MAX_PATH_LEN];
extern char rootSDdir[MAXPATHLEN];
extern char currSDdir[MAXPATHLEN];
#endif

View File

@ -44,6 +44,8 @@ SMBINFO smbinfo =
SMB_USER, SMB_PWD, SMB_GCID, SMB_SVID, SMB_SHARE
};
extern FILEENTRIES filelist[MAXFILES];
/****************************************************************************
* Mount SMB Share
****************************************************************************/
@ -63,19 +65,19 @@ ConnectSMB ()
if (netinited == 0)
{
ShowAction ("Setting up network interface ...");
ShowAction ((char*) "Setting up network interface ...");
ret = if_config (smbinfo.gcip, smbinfo.gwip, smbinfo.mask, 0);
netinited = 1;
}
ShowAction ("Connecting to share ...");
ShowAction ((char*) "Connecting to share ...");
SMB_Destroy ();
if (SMB_Init (smbinfo.smbuser, smbinfo.smbpwd,
smbinfo.smbgcid, smbinfo.smbsvid, smbinfo.smbshare,
smbinfo.smbip) != SMB_SUCCESS)
{
WaitPrompt ("Failed to connect to SMB share");
WaitPrompt((char*) "Failed to connect to SMB share");
connected = 0;
return;
}
@ -264,7 +266,7 @@ LoadSMBFile (char *filename, int length)
}
else
{
WaitPrompt ("SMB Reading Failed!");
WaitPrompt((char*) "SMB Reading Failed!");
//while (1);
return 0;
}
@ -380,7 +382,7 @@ SaveSRAMToSMB (bool8 silent)
int offset;
sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMName);
ShowAction ("Saving SRAM to SMB...");
ShowAction ((char*) "Saving SRAM to SMB...");
datasize = prepareEXPORTsavedata ();
@ -406,7 +408,7 @@ LoadSRAMFromSMB (bool8 silent)
int offset;
sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMName);
ShowAction ("Loading SRAM from SMB...");
ShowAction ((char*) "Loading SRAM from SMB...");
offset = LoadBufferFromSMB (filepath, silent);
@ -434,7 +436,7 @@ SavePrefsToSMB (bool8 silent)
int offset;
sprintf (filepath, "%s\\%s", SNESSAVEDIR, PREFS_FILE_NAME);
ShowAction ("Saving preferences to SMB...");
ShowAction ((char*) "Saving preferences to SMB...");
datasize = preparePrefsData ();
@ -460,7 +462,7 @@ LoadPrefsFromSMB (bool8 silent)
char filepath[1024];
int offset;
ShowAction ("Loading preferences from SMB...");
ShowAction ((char*) "Loading preferences from SMB...");
sprintf (filepath, "%s\\%s", SNESSAVEDIR, PREFS_FILE_NAME);

View File

@ -157,6 +157,14 @@
#include <stdlib.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 "memmap.h"
#include "debug.h"
@ -186,7 +194,7 @@ unsigned long ARAM_ROMSIZE = 0;
int ConfigRequested = 0;
extern int FrameTimer;
extern tb_t prev;
extern long long prev;
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_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
/****************************************************************************
@ -260,13 +275,15 @@ decodepad (int pad)
{
int i, offset;
signed char x, y;
unsigned short jp;
//unsigned short jp, wp; //
u16 jp, wp;
float t;
/*** Do analogue updates ***/
x = PAD_StickX (pad);
y = PAD_StickY (pad);
jp = PAD_ButtonsHeld (pad);
wp = WPAD_ButtonsHeld (pad); // wiimote
/*** Is XY inside the "zone"? ***/
if (x * x + y * y > padcal * padcal)
@ -316,6 +333,10 @@ decodepad (int pad)
S9xReportButton (offset + i, true);
else
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
NGCReportButtons ()
{
s8 px = PAD_SubStickX (0);
s8 py = PAD_SubStickY (0);
u16 pb = PAD_ButtonsHeld (0);
s8 gc_px = PAD_SubStickX (0);
s8 gc_py = PAD_SubStickY (0);
u16 gc_pb = PAD_ButtonsHeld (0);
u16 wm_pb = WPAD_ButtonsHeld (0); // wiimote
/*** Check for video zoom ***/
if (GCSettings.NGCZoom)
{
if (py < -18 || py > 18)
zoom ((float) py / -18);
if (gc_py < -18 || gc_py > 18)
zoom ((float) gc_py / -18);
}
Settings.TurboMode = (px > 70);
Settings.TurboMode = (gc_px > 70);
/*** Check for menu:
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) ||
((pb & PAD_TRIGGER_L) &&
(pb & PAD_TRIGGER_R ) &&
(pb & PAD_BUTTON_X) &&
(pb & PAD_BUTTON_Y ))
if ((gc_px < -70) ||
((gc_pb & PAD_TRIGGER_L) &&
(gc_pb & PAD_TRIGGER_R ) &&
(gc_pb & PAD_BUTTON_X) &&
(gc_pb & PAD_BUTTON_Y )) ||
(wm_pb & WPAD_BUTTON_HOME) // wiimote
)
{
ConfigRequested = 1;
@ -357,17 +381,17 @@ NGCReportButtons ()
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 );
}
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 );
}
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 );
quickSaveFreeze ( SILENT );
@ -476,21 +500,40 @@ SetDefaultButtonMap ()
****************************************************************************/
/* Eke-Eke: initialize frame Sync */
extern void S9xInitSync();
extern u8 vmode_60hz;
int timerstyle;
void
emulate ()
{
S9xSetSoundMute (TRUE);
// FrameTimer = 0;
AudioStart ();
S9xInitSync();
S9xSetSoundMute (TRUE);
AudioStart ();
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)
{
S9xMainLoop ();
NGCReportButtons ();
}
while (1)
{
S9xMainLoop ();
NGCReportButtons ();
}
}
/****************************************************************************
@ -521,6 +564,15 @@ main ()
/*** Initialise GC ***/
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
isWii = TRUE;
#else
@ -530,6 +582,9 @@ main ()
else
isWii = TRUE;
#endif
WPAD_Init();
/*** Initialise freetype ***/
if (FT_Init ())
@ -537,6 +592,7 @@ main ()
printf ("Cannot initialise font subsystem!\n");
while (1);
}
setfontsize (16);/***sets the font size.***/
/*** Set defaults ***/
DefaultSettings ();
@ -596,12 +652,8 @@ main ()
/*** Load SRAM ***/
Memory.LoadSRAM ("DVD");
if ( GCSettings.AutoLoad == 1 )
quickLoadSRAM ( SILENT );
else if ( GCSettings.AutoLoad == 2 )
quickLoadFreeze ( SILENT );
}
/*** Emulate ***/
emulate ();

View File

@ -201,17 +201,6 @@ END_EXTERN_C
#define QUICK_SAVE_SLOT 1
#endif
/*** if defined, LOAD_TYPE specifies type of load allowed:
0 = All load types allowed - show submenu
1 = DVD only
2 = SMB only
3 = SD only
This settings is something I use to allow me to make a version for my kids,
where I want it to be easy and they'll never be using SD or SMB ***/
#ifndef LOAD_TYPE
#define LOAD_TYPE 0
#endif
/*** default SMB settings ***/
#ifndef GC_IP
#define GC_IP "192.168.1.32" /*** IP to assign the GameCube ***/

View File

@ -173,7 +173,7 @@ decodesavedata (int readsize)
if ( strncmp (sramcomment, "Snes9x GX 2.0", 13) == 0 )
{
//WaitPrompt ("Memory Card format save");
//WaitPrompt((char*) "Memory Card format save");
offset += 64;
memcpy (&size, savebuffer + offset, 4);
offset += 4;

View File

@ -14,6 +14,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <wiiuse/wpad.h>
#include "snes9x.h"
#include "memmap.h"
//#include "debug.h"
@ -40,7 +42,7 @@ extern unsigned int SMBTimer;
unsigned int *xfb[2] = { NULL, NULL }; /*** Double buffered ***/
int whichfb = 0; /*** Switch ***/
GXRModeObj *vmode; /*** General video mode ***/
int screenheight = 480;
int screenheight;
/*** GX ***/
#define TEX_WIDTH 512
@ -55,6 +57,8 @@ int vwidth, vheight, oldvwidth, oldvheight;
u32 FrameTimer = 0;
u8 vmode_60hz = 0;
#define HASPECT 76
#define VASPECT 54
@ -258,6 +262,17 @@ StartGX ()
vheight = 100;
}
/****************************************************************************
* UpdatePads
*
* called by postRetraceCallback in InitGCVideo - scans gcpad and wpad
****************************************************************************/
void UpdatePadsCB()
{
WPAD_ScanPads();
PAD_ScanPads();
}
/****************************************************************************
* InitGCVideo
*
@ -276,7 +291,7 @@ InitGCVideo ()
VIDEO_Init ();
PAD_Init ();
DVD_Init ();
//DVD_Init ();
/*** Check to see if this is a GC or a Wii ***/
// int driveid = dvd_driveid();
@ -293,10 +308,31 @@ InitGCVideo ()
ARAMPut ((char *) romptr, (char *) AR_SNESROM, ARAM_ROMSIZE);
}
/*
* Always use NTSC mode - this works on NTSC and PAL, GC and Wii
*/
vmode = &TVNtsc480IntDf;
/*
* Always use NTSC mode - this works on NTSC and PAL, GC and Wii
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);
screenheight = vmode->xfbHeight;
@ -304,14 +340,13 @@ InitGCVideo ()
/*
* Allocate the video buffers
*/
xfb[0] = (unsigned int *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
xfb[1] = (unsigned int *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
/*
* A console is always useful while debugging.
*/
console_init (xfb[0], 20, 64, vmode->fbWidth, vmode->xfbHeight,
vmode->fbWidth * 2);
console_init (xfb[0], 20, 64, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * 2);
/*
* Clear framebuffers etc.
@ -323,15 +358,15 @@ InitGCVideo ()
/*
* Let libogc populate manage the PADs for us
*/
VIDEO_SetPostRetraceCallback (PAD_ScanPads);
VIDEO_SetPreRetraceCallback (copy_to_xfb);
//VIDEO_SetPostRetraceCallback ((VIRetraceCallback)PAD_ScanPads);
VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB);
VIDEO_SetPreRetraceCallback ((VIRetraceCallback)copy_to_xfb);
VIDEO_SetBlack (FALSE);
VIDEO_Flush ();
VIDEO_WaitVSync ();
if (vmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync ();
// DVD_Init ();
copynow = GX_FALSE;
StartGX ();
@ -348,11 +383,11 @@ InitGCVideo ()
* Drawing screen
****************************************************************************/
void
clearscreen ()
clearscreen (int colour)
{
whichfb ^= 1;
ARAMFetch ((char *) xfb[whichfb], (char *) AR_BACKDROP,
640 * screenheight * 2);
//ARAMFetch ((char *) xfb[whichfb], (char *) AR_BACKDROP, 640 * screenheight * 2); // FIX
VIDEO_ClearFrameBuffer (vmode, xfb[whichfb], colour);
}
void

View File

@ -11,13 +11,17 @@
#ifndef _GCVIDEOH_
#define _GCVIDEOH_
//#include <gccore.h>
#include <ogcsys.h>
#include "snes9x.h"
void InitGCVideo ();
void clearscreen ();
void clearscreen (int colour = COLOR_WHITE);
void showscreen ();
void setGFX ();
void update_video (int width, int height);
void zoom (float speed);
void UpdatePadsCB();
#endif

View File

@ -141,6 +141,7 @@
Nintendo Co., Limited and its subsidiary companies.
**********************************************************************************/
#define _GLOBALS_CPP
#include "snes9x.h"
#include "memmap.h"
@ -168,7 +169,7 @@
#include "spc7110.h"
START_EXTERN_C
//START_EXTERN_C
char String[513];
struct Missing missing;
@ -210,12 +211,12 @@ uint8 *RegRAM = NULL;
CMemory Memory;
struct SSNESGameFixes SNESGameFixes;
SSNESGameFixes SNESGameFixes;
unsigned char OpenBus = 0;
END_EXTERN_C
//END_EXTERN_C
#ifndef ZSNES_FX
struct FxInit_s SuperFX;

View File

@ -409,9 +409,11 @@ typedef struct{
uint8 _5A22;
} SnesModel;
#ifndef _GLOBALS_CPP
extern SnesModel* Model;
extern SnesModel M1SNES;
extern SnesModel M2SNES;
#endif
#define MAX_5C77_VERSION 0x01
#define MAX_5C78_VERSION 0x03