merged new GUI to trunk
43
Makefile.gc
@ -18,22 +18,24 @@ include $(DEVKITPPC)/gamecube_rules
|
|||||||
TARGET := snes9xgx-gc
|
TARGET := snes9xgx-gc
|
||||||
TARGETDIR := executables
|
TARGETDIR := executables
|
||||||
BUILD := build_gc
|
BUILD := build_gc
|
||||||
SOURCES := source/snes9x source/ngc source/sz source/unzip
|
SOURCES := source/ngc/images source/ngc/sounds source/ngc/fonts \
|
||||||
INCLUDES := source/snes9x source/ngc source/unzip
|
source/ngc/gui source/ngc source/snes9x source/sz
|
||||||
|
INCLUDES := source/snes9x source/ngc
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) \
|
CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) \
|
||||||
-DNGC \
|
-DNGC -DNO_SOUND \
|
||||||
-DNO_ASM -DRIGHTSHIFT_IS_SAR \
|
-DNO_ASM -DRIGHTSHIFT_IS_SAR \
|
||||||
-DCPU_SHUTDOWN -DSPC700_SHUTDOWN \
|
-DCPU_SHUTDOWN -DSPC700_SHUTDOWN \
|
||||||
-DSPC700_C -DSDD1_DECOMP \
|
-DSPC700_C -DSDD1_DECOMP \
|
||||||
-DCORRECT_VRAM_READS -DNEW_COLOUR_BLENDING \
|
-DCORRECT_VRAM_READS -DNEW_COLOUR_BLENDING \
|
||||||
-D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \
|
-D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \
|
||||||
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
|
-fomit-frame-pointer -fno-exceptions \
|
||||||
#-D_DEBUG_VIDEO -pipe
|
-Wno-unused-parameter -Wno-strict-aliasing
|
||||||
|
|
||||||
CXXFLAGS = $(CFLAGS)
|
CXXFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
|
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||||
@ -41,7 +43,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# any extra libraries we wish to link with the project
|
# any extra libraries we wish to link with the project
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
LIBS := -lpngu -lpng -lmxml -lbba -ltinysmb -lfat -lz -logc -lm -lfreetype
|
LIBS := -lpngu -lpng -lmxml -lfreetypegx -lmetaphrasis -lfat -lz -logc -lfreetype
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
@ -57,10 +59,7 @@ ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
|
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@ -70,7 +69,9 @@ 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)/*.*)))
|
TTFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.ttf)))
|
||||||
|
PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png)))
|
||||||
|
PCMFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcm)))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
@ -81,9 +82,10 @@ else
|
|||||||
export LD := $(CXX)
|
export LD := $(CXX)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
$(sFILES:.s=.o) $(SFILES:.S=.o) \
|
||||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
$(TTFFILES:.ttf=.ttf.o) $(PNGFILES:.png=.png.o) \
|
||||||
|
$(PCMFILES:.pcm=.pcm.o)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# build a list of include paths
|
# build a list of include paths
|
||||||
@ -134,10 +136,17 @@ $(OUTPUT).dol: $(OUTPUT).elf
|
|||||||
$(OUTPUT).elf: $(OFILES)
|
$(OUTPUT).elf: $(OFILES)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# This rule links in binary data with the .jpg extension
|
# This rule links in binary data with .ttf, .png, and .mp3 extensions
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.jpg.o : %.jpg
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
%.ttf.o : %.ttf
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(bin2o)
|
||||||
|
|
||||||
|
%.png.o : %.png
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(bin2o)
|
||||||
|
|
||||||
|
%.pcm.o : %.pcm
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
$(bin2o)
|
$(bin2o)
|
||||||
|
|
||||||
|
51
Makefile.wii
@ -18,7 +18,8 @@ include $(DEVKITPPC)/wii_rules
|
|||||||
TARGET := snes9xgx-wii
|
TARGET := snes9xgx-wii
|
||||||
TARGETDIR := executables
|
TARGETDIR := executables
|
||||||
BUILD := build_wii
|
BUILD := build_wii
|
||||||
SOURCES := source/snes9x source/ngc source/sz source/unzip
|
SOURCES := source/ngc/images source/ngc/sounds source/ngc/fonts \
|
||||||
|
source/ngc/gui source/ngc source/snes9x source/sz source/unzip
|
||||||
INCLUDES := source/snes9x source/ngc source/unzip
|
INCLUDES := source/snes9x source/ngc source/unzip
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@ -26,15 +27,15 @@ INCLUDES := source/snes9x source/ngc source/unzip
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) \
|
CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) \
|
||||||
-DNGC -DWII_DVD \
|
-DNGC \
|
||||||
-DNO_ASM -DRIGHTSHIFT_IS_SAR \
|
-DNO_ASM -DRIGHTSHIFT_IS_SAR \
|
||||||
-DCPU_SHUTDOWN -DSPC700_SHUTDOWN \
|
-DCPU_SHUTDOWN -DSPC700_SHUTDOWN \
|
||||||
-DSPC700_C -DSDD1_DECOMP \
|
-DSPC700_C -DSDD1_DECOMP \
|
||||||
-DCORRECT_VRAM_READS -DNEW_COLOUR_BLENDING \
|
-DCORRECT_VRAM_READS -DNEW_COLOUR_BLENDING \
|
||||||
-D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \
|
-D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ \
|
||||||
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter \
|
-fomit-frame-pointer -fno-exceptions \
|
||||||
-DDEBUG_WII \
|
-Wno-unused-parameter -Wno-strict-aliasing
|
||||||
#-D_DEBUG_VIDEO -pipe
|
|
||||||
CXXFLAGS = -save-temps -Xassembler -aln=$@.lst $(CFLAGS)
|
CXXFLAGS = -save-temps -Xassembler -aln=$@.lst $(CFLAGS)
|
||||||
|
|
||||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||||
@ -42,8 +43,8 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# any extra libraries we wish to link with the project
|
# any extra libraries we wish to link with the project
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
LIBS := -ldb -ldi -lpngu -lpng -lmxml -lfat -lwiiuse -lz -lbte -logc -lm -lfreetype -ltinysmb
|
LIBS := -ldb -ldi -lpngu -lpng -lmxml -lfreetypegx -lmetaphrasis \
|
||||||
|
-lfat -lwiiuse -lz -lbte -logc -lasnd -ltremor -lfreetype -ltinysmb
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
# include and lib
|
# include and lib
|
||||||
@ -58,10 +59,7 @@ ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
|
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@ -71,8 +69,11 @@ 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)/*.*)))
|
TTFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.ttf)))
|
||||||
|
PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png)))
|
||||||
|
OGGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.ogg)))
|
||||||
|
PCMFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcm)))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@ -82,9 +83,10 @@ else
|
|||||||
export LD := $(CXX)
|
export LD := $(CXX)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
$(sFILES:.s=.o) $(SFILES:.S=.o) \
|
||||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
$(TTFFILES:.ttf=.ttf.o) $(PNGFILES:.png=.png.o) \
|
||||||
|
$(OGGFILES:.ogg=.ogg.o) $(PCMFILES:.pcm=.pcm.o)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# build a list of include paths
|
# build a list of include paths
|
||||||
@ -135,10 +137,21 @@ $(OUTPUT).dol: $(OUTPUT).elf
|
|||||||
$(OUTPUT).elf: $(OFILES)
|
$(OUTPUT).elf: $(OFILES)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# This rule links in binary data with the .jpg extension
|
# This rule links in binary data with .ttf, .png, and .mp3 extensions
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.jpg.o : %.jpg
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
%.ttf.o : %.ttf
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(bin2o)
|
||||||
|
|
||||||
|
%.png.o : %.png
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(bin2o)
|
||||||
|
|
||||||
|
%.ogg.o : %.ogg
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(bin2o)
|
||||||
|
|
||||||
|
%.pcm.o : %.pcm
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
$(bin2o)
|
$(bin2o)
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <asndlib.h>
|
||||||
|
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
@ -29,7 +30,6 @@
|
|||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
|
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "menudraw.h"
|
|
||||||
|
|
||||||
extern int ConfigRequested;
|
extern int ConfigRequested;
|
||||||
|
|
||||||
@ -74,13 +74,15 @@ AudioThread (void *arg)
|
|||||||
static void
|
static void
|
||||||
GCMixSamples ()
|
GCMixSamples ()
|
||||||
{
|
{
|
||||||
AUDIO_StopDMA ();
|
if (!ConfigRequested)
|
||||||
|
{
|
||||||
|
AUDIO_StopDMA ();
|
||||||
|
DCFlushRange (soundbuffer[whichab], AUDIOBUFFER);
|
||||||
|
AUDIO_InitDMA ((u32) soundbuffer[whichab], AUDIOBUFFER);
|
||||||
|
AUDIO_StartDMA ();
|
||||||
|
|
||||||
DCFlushRange (soundbuffer[whichab], AUDIOBUFFER);
|
LWP_ThreadSignal (audioqueue);
|
||||||
AUDIO_InitDMA ((u32) soundbuffer[whichab], AUDIOBUFFER);
|
}
|
||||||
AUDIO_StartDMA ();
|
|
||||||
|
|
||||||
LWP_ThreadSignal (audioqueue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -89,12 +91,32 @@ GCMixSamples ()
|
|||||||
void
|
void
|
||||||
InitGCAudio ()
|
InitGCAudio ()
|
||||||
{
|
{
|
||||||
AUDIO_SetDSPSampleRate (AI_SAMPLERATE_32KHZ);
|
|
||||||
AUDIO_RegisterDMACallback (GCMixSamples);
|
|
||||||
|
|
||||||
LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 150);
|
LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 150);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SwitchAudioMode(int mode)
|
||||||
|
{
|
||||||
|
if(mode == 0) // emulator
|
||||||
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
|
ASND_Pause(1);
|
||||||
|
ASND_End();
|
||||||
|
#endif
|
||||||
|
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_32KHZ);
|
||||||
|
AUDIO_RegisterDMACallback(GCMixSamples);
|
||||||
|
}
|
||||||
|
else // menu
|
||||||
|
{
|
||||||
|
AUDIO_StopDMA();
|
||||||
|
AUDIO_RegisterDMACallback(NULL);
|
||||||
|
#ifndef NO_SOUND
|
||||||
|
ASND_Init();
|
||||||
|
ASND_Pause(0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* AudioStart
|
* AudioStart
|
||||||
*
|
*
|
||||||
|
@ -11,3 +11,4 @@
|
|||||||
|
|
||||||
void InitGCAudio ();
|
void InitGCAudio ();
|
||||||
void AudioStart ();
|
void AudioStart ();
|
||||||
|
void SwitchAudioMode(int mode);
|
||||||
|
@ -25,6 +25,50 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
CtrlrMap ctrlr_def[4] = {
|
CtrlrMap ctrlr_def[4] = {
|
||||||
|
// Gamecube controller btn def
|
||||||
|
{
|
||||||
|
CTRLR_GCPAD,
|
||||||
|
13,
|
||||||
|
{
|
||||||
|
{PAD_BUTTON_DOWN, "DOWN"},
|
||||||
|
{PAD_BUTTON_UP, "UP"},
|
||||||
|
{PAD_BUTTON_LEFT, "LEFT"},
|
||||||
|
{PAD_BUTTON_RIGHT, "RIGHT"},
|
||||||
|
{PAD_BUTTON_A, "A"},
|
||||||
|
{PAD_BUTTON_B, "B"},
|
||||||
|
{PAD_BUTTON_X, "X"},
|
||||||
|
{PAD_BUTTON_Y, "Y"},
|
||||||
|
{PAD_BUTTON_MENU, "START"},
|
||||||
|
{PAD_BUTTON_START, "START"},
|
||||||
|
{PAD_TRIGGER_L, "L"},
|
||||||
|
{PAD_TRIGGER_R, "R"},
|
||||||
|
{PAD_TRIGGER_Z, "Z"},
|
||||||
|
{0, ""},
|
||||||
|
{0, ""}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Wiimote btn def
|
||||||
|
{
|
||||||
|
CTRLR_WIIMOTE,
|
||||||
|
11,
|
||||||
|
{
|
||||||
|
{WPAD_BUTTON_DOWN, "DOWN"},
|
||||||
|
{WPAD_BUTTON_UP, "UP"},
|
||||||
|
{WPAD_BUTTON_LEFT, "LEFT"},
|
||||||
|
{WPAD_BUTTON_RIGHT, "RIGHT"},
|
||||||
|
{WPAD_BUTTON_A, "A"},
|
||||||
|
{WPAD_BUTTON_B, "B"},
|
||||||
|
{WPAD_BUTTON_1, "1"},
|
||||||
|
{WPAD_BUTTON_2, "2"},
|
||||||
|
{WPAD_BUTTON_PLUS, "PLUS"},
|
||||||
|
{WPAD_BUTTON_MINUS, "MINUS"},
|
||||||
|
{WPAD_BUTTON_HOME, "HOME"},
|
||||||
|
{0, ""},
|
||||||
|
{0, ""},
|
||||||
|
{0, ""},
|
||||||
|
{0, ""}
|
||||||
|
}
|
||||||
|
},
|
||||||
// Nunchuk btn def
|
// Nunchuk btn def
|
||||||
{
|
{
|
||||||
CTRLR_NUNCHUK,
|
CTRLR_NUNCHUK,
|
||||||
@ -63,55 +107,10 @@ CtrlrMap ctrlr_def[4] = {
|
|||||||
{WPAD_CLASSIC_BUTTON_PLUS, "PLUS"},
|
{WPAD_CLASSIC_BUTTON_PLUS, "PLUS"},
|
||||||
{WPAD_CLASSIC_BUTTON_MINUS, "MINUS"},
|
{WPAD_CLASSIC_BUTTON_MINUS, "MINUS"},
|
||||||
{WPAD_CLASSIC_BUTTON_HOME, "HOME"},
|
{WPAD_CLASSIC_BUTTON_HOME, "HOME"},
|
||||||
{WPAD_CLASSIC_BUTTON_FULL_L, "L TRIG"},
|
{WPAD_CLASSIC_BUTTON_FULL_L, "L"},
|
||||||
{WPAD_CLASSIC_BUTTON_FULL_R, "R TRIG"},
|
{WPAD_CLASSIC_BUTTON_FULL_R, "R"},
|
||||||
{WPAD_CLASSIC_BUTTON_ZL, "ZL"},
|
{WPAD_CLASSIC_BUTTON_ZL, "ZL"},
|
||||||
{WPAD_CLASSIC_BUTTON_ZR, "ZR"}
|
{WPAD_CLASSIC_BUTTON_ZR, "ZR"}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
// Gamecube controller btn def
|
|
||||||
{
|
|
||||||
CTRLR_GCPAD,
|
|
||||||
13,
|
|
||||||
{
|
|
||||||
{PAD_BUTTON_DOWN, "DOWN"},
|
|
||||||
{PAD_BUTTON_UP, "UP"},
|
|
||||||
{PAD_BUTTON_LEFT, "LEFT"},
|
|
||||||
{PAD_BUTTON_RIGHT, "RIGHT"},
|
|
||||||
{PAD_BUTTON_A, "A"},
|
|
||||||
{PAD_BUTTON_B, "B"},
|
|
||||||
{PAD_BUTTON_X, "X"},
|
|
||||||
{PAD_BUTTON_Y, "Y"},
|
|
||||||
{PAD_BUTTON_MENU, "MENU"},
|
|
||||||
{PAD_BUTTON_START, "START"},
|
|
||||||
{PAD_TRIGGER_L, "L TRIG"},
|
|
||||||
{PAD_TRIGGER_R, "R TRIG"},
|
|
||||||
{PAD_TRIGGER_Z, "Z"},
|
|
||||||
{0, ""},
|
|
||||||
{0, ""}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Wiimote btn def
|
|
||||||
{
|
|
||||||
CTRLR_WIIMOTE,
|
|
||||||
11,
|
|
||||||
{
|
|
||||||
{WPAD_BUTTON_DOWN, "DOWN"},
|
|
||||||
{WPAD_BUTTON_UP, "UP"},
|
|
||||||
{WPAD_BUTTON_LEFT, "LEFT"},
|
|
||||||
{WPAD_BUTTON_RIGHT, "RIGHT"},
|
|
||||||
{WPAD_BUTTON_A, "A"},
|
|
||||||
{WPAD_BUTTON_B, "B"},
|
|
||||||
{WPAD_BUTTON_1, "1"},
|
|
||||||
{WPAD_BUTTON_2, "2"},
|
|
||||||
{WPAD_BUTTON_PLUS, "PLUS"},
|
|
||||||
{WPAD_BUTTON_MINUS, "MINUS"},
|
|
||||||
{WPAD_BUTTON_HOME, "HOME"},
|
|
||||||
{0, ""},
|
|
||||||
{0, ""},
|
|
||||||
{0, ""},
|
|
||||||
{0, ""}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,13 +13,15 @@
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
CTRLR_NONE = -1,
|
CTRLR_NONE = -1,
|
||||||
CTRLR_NUNCHUK,
|
|
||||||
CTRLR_CLASSIC,
|
|
||||||
CTRLR_GCPAD,
|
CTRLR_GCPAD,
|
||||||
CTRLR_WIIMOTE,
|
CTRLR_WIIMOTE,
|
||||||
CTRLR_SNES = 7 // give some other value for the snes padmap
|
CTRLR_NUNCHUK,
|
||||||
|
CTRLR_CLASSIC
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char ctrlrName[4][20] =
|
||||||
|
{ "GameCube Controller", "Wiimote", "Nunchuk + Wiimote", "Classic Controller" };
|
||||||
|
|
||||||
typedef struct _btn_map {
|
typedef struct _btn_map {
|
||||||
u32 btn; // button 'id'
|
u32 btn; // button 'id'
|
||||||
char* name; // button name
|
char* name; // button name
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
*
|
*
|
||||||
* Tantric August 2008
|
* Tantric 2008-2009
|
||||||
*
|
*
|
||||||
* cheatmgr.cpp
|
* cheatmgr.cpp
|
||||||
*
|
*
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "snes9xGX.h"
|
#include "snes9xGX.h"
|
||||||
#include "fileop.h"
|
#include "fileop.h"
|
||||||
#include "menudraw.h"
|
#include "filebrowser.h"
|
||||||
|
|
||||||
extern SCheatData Cheat;
|
extern SCheatData Cheat;
|
||||||
|
|
||||||
@ -71,6 +71,9 @@ SetupCheats()
|
|||||||
if(method == METHOD_AUTO)
|
if(method == METHOD_AUTO)
|
||||||
method = autoSaveMethod(SILENT);
|
method = autoSaveMethod(SILENT);
|
||||||
|
|
||||||
|
if(method == METHOD_AUTO)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!MakeFilePath(filepath, FILE_CHEAT, method))
|
if(!MakeFilePath(filepath, FILE_CHEAT, method))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Cheat handling
|
* Cheat handling
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#include "cheats.h"
|
||||||
|
|
||||||
void SetupCheats();
|
void SetupCheats();
|
||||||
|
|
||||||
|
@ -23,9 +23,9 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "menudraw.h"
|
#include "menu.h"
|
||||||
#include "gcunzip.h"
|
#include "gcunzip.h"
|
||||||
#include "filesel.h"
|
#include "filebrowser.h"
|
||||||
#include "snes9xGX.h"
|
#include "snes9xGX.h"
|
||||||
|
|
||||||
#define MAXDVDFILES 2000
|
#define MAXDVDFILES 2000
|
||||||
@ -76,7 +76,7 @@ dvd_read (void *dst, unsigned int len, u64 offset)
|
|||||||
dvd[7] = 3;
|
dvd[7] = 3;
|
||||||
|
|
||||||
// Enable reading with DMA
|
// Enable reading with DMA
|
||||||
while (dvd[7] & 1);
|
while (dvd[7] & 1) usleep(50);
|
||||||
|
|
||||||
// Ensure it has completed
|
// Ensure it has completed
|
||||||
if (dvd[0] & 0x4)
|
if (dvd[0] & 0x4)
|
||||||
@ -323,32 +323,38 @@ getpvd ()
|
|||||||
|
|
||||||
bool MountDVD(bool silent)
|
bool MountDVD(bool silent)
|
||||||
{
|
{
|
||||||
if (!getpvd())
|
bool res = false;
|
||||||
|
|
||||||
|
if (getpvd())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ShowAction("Loading DVD...");
|
ShowAction("Loading DVD...");
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
DVD_Mount(); // mount the DVD unit again
|
DVD_Mount(); // mount the DVD unit again
|
||||||
#elif HW_RVL
|
#else
|
||||||
u32 val;
|
u32 val;
|
||||||
DI_GetCoverRegister(&val);
|
DI_GetCoverRegister(&val);
|
||||||
if(val & 0x1) // True if no disc inside, use (val & 0x2) for true if disc inside.
|
if(val & 0x1) // True if no disc inside, use (val & 0x2) for true if disc inside.
|
||||||
{
|
{
|
||||||
if(!silent)
|
if(!silent)
|
||||||
WaitPrompt("No disc inserted!");
|
ErrorPrompt("No disc inserted!");
|
||||||
|
CancelAction();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
DI_Mount();
|
DI_Mount();
|
||||||
while(DI_GetStatus() & DVD_INIT);
|
while(DI_GetStatus() & DVD_INIT) usleep(20000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!getpvd())
|
if (getpvd())
|
||||||
{
|
res = true;
|
||||||
if(!silent)
|
else if(!silent)
|
||||||
WaitPrompt ("Invalid DVD.");
|
ErrorPrompt("Invalid DVD.");
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
CancelAction();
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -447,7 +453,7 @@ getentry (int entrycount, unsigned char dvdbuffer[])
|
|||||||
if(!newBrowserList) // failed to allocate required memory
|
if(!newBrowserList) // failed to allocate required memory
|
||||||
{
|
{
|
||||||
ResetBrowser();
|
ResetBrowser();
|
||||||
WaitPrompt("Out of memory: too many files!");
|
ErrorPrompt("Out of memory: too many files!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -485,7 +491,7 @@ getentry (int entrycount, unsigned char dvdbuffer[])
|
|||||||
* It relies on dvddir and dvddirlength being pre-populated by a call to
|
* It relies on dvddir and dvddirlength being pre-populated by a call to
|
||||||
* getpvd, a previous parse or a menu selection.
|
* getpvd, a previous parse or a menu selection.
|
||||||
*
|
*
|
||||||
* The return value is number of files collected, or 0 on failure.
|
* The return value is number of files collected, or -1 on failure.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int
|
int
|
||||||
ParseDVDdirectory ()
|
ParseDVDdirectory ()
|
||||||
@ -508,7 +514,7 @@ ParseDVDdirectory ()
|
|||||||
while (len < pdlength)
|
while (len < pdlength)
|
||||||
{
|
{
|
||||||
if (dvd_read (&dvdbuffer, 2048, pdoffset) == 0)
|
if (dvd_read (&dvdbuffer, 2048, pdoffset) == 0)
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
diroffset = 0;
|
diroffset = 0;
|
||||||
|
|
||||||
@ -525,6 +531,7 @@ ParseDVDdirectory ()
|
|||||||
// Sort the file list
|
// Sort the file list
|
||||||
qsort(browserList, filecount, sizeof(BROWSERENTRY), FileSortCallback);
|
qsort(browserList, filecount, sizeof(BROWSERENTRY), FileSortCallback);
|
||||||
|
|
||||||
|
browser.numEntries = filecount;
|
||||||
return filecount;
|
return filecount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,9 +591,10 @@ static bool SwitchDVDFolderR(char * dir, int maxDepth)
|
|||||||
dvddir = browserList[dirindex].offset;
|
dvddir = browserList[dirindex].offset;
|
||||||
dvddirlength = browserList[dirindex].length;
|
dvddirlength = browserList[dirindex].length;
|
||||||
browser.selIndex = dirindex;
|
browser.selIndex = dirindex;
|
||||||
|
UpdateDirName(METHOD_DVD);
|
||||||
|
|
||||||
if(browserList[dirindex].isdir) // only parse directories
|
if(browserList[dirindex].isdir) // only parse directories
|
||||||
browser.numEntries = ParseDVDdirectory();
|
ParseDVDdirectory();
|
||||||
|
|
||||||
if(lastdir)
|
if(lastdir)
|
||||||
return true;
|
return true;
|
||||||
@ -599,8 +607,8 @@ static bool SwitchDVDFolderR(char * dir, int maxDepth)
|
|||||||
bool SwitchDVDFolder(char origdir[])
|
bool SwitchDVDFolder(char origdir[])
|
||||||
{
|
{
|
||||||
// make a copy of origdir so we don't mess with original
|
// make a copy of origdir so we don't mess with original
|
||||||
char dir[200];
|
char dir[1024];
|
||||||
strcpy(dir, origdir);
|
strncpy(dir, origdir, 1024);
|
||||||
|
|
||||||
char * dirptr = dir;
|
char * dirptr = dir;
|
||||||
|
|
||||||
@ -614,6 +622,7 @@ bool SwitchDVDFolder(char origdir[])
|
|||||||
// start searching at root of DVD
|
// start searching at root of DVD
|
||||||
dvddir = dvdrootdir;
|
dvddir = dvdrootdir;
|
||||||
dvddirlength = dvdrootlength;
|
dvddirlength = dvdrootlength;
|
||||||
|
browser.dir[0] = 0;
|
||||||
ParseDVDdirectory();
|
ParseDVDdirectory();
|
||||||
|
|
||||||
return SwitchDVDFolderR(dirptr, 0);
|
return SwitchDVDFolderR(dirptr, 0);
|
||||||
@ -628,6 +637,7 @@ bool SwitchDVDFolder(char origdir[])
|
|||||||
int
|
int
|
||||||
LoadDVDFileOffset (unsigned char *buffer, int length)
|
LoadDVDFileOffset (unsigned char *buffer, int length)
|
||||||
{
|
{
|
||||||
|
int result = 0;
|
||||||
int offset;
|
int offset;
|
||||||
int blocks;
|
int blocks;
|
||||||
int i;
|
int i;
|
||||||
@ -645,17 +655,19 @@ LoadDVDFileOffset (unsigned char *buffer, int length)
|
|||||||
{
|
{
|
||||||
ret = dvd_read (buffer, length, discoffset);
|
ret = dvd_read (buffer, length, discoffset);
|
||||||
if(ret <= 0) // read failure
|
if(ret <= 0) // read failure
|
||||||
return 0;
|
goto done;
|
||||||
|
else
|
||||||
|
result = length;
|
||||||
}
|
}
|
||||||
else // load whole file
|
else // load whole file
|
||||||
{
|
{
|
||||||
ret = dvd_read (readbuffer, 2048, discoffset);
|
ret = dvd_read (readbuffer, 2048, discoffset);
|
||||||
if(ret <= 0) // read failure
|
if(ret <= 0) // read failure
|
||||||
return 0;
|
goto done;
|
||||||
|
|
||||||
if (IsZipFile (readbuffer))
|
if (IsZipFile (readbuffer))
|
||||||
{
|
{
|
||||||
return UnZipBuffer (buffer, METHOD_DVD); // unzip from dvd
|
result = UnZipBuffer (buffer, METHOD_DVD); // unzip from dvd
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -663,7 +675,7 @@ LoadDVDFileOffset (unsigned char *buffer, int length)
|
|||||||
{
|
{
|
||||||
ret = dvd_read (readbuffer, 2048, discoffset);
|
ret = dvd_read (readbuffer, 2048, discoffset);
|
||||||
if(ret <= 0) // read failure
|
if(ret <= 0) // read failure
|
||||||
return 0;
|
goto done;
|
||||||
memcpy (buffer + offset, readbuffer, 2048);
|
memcpy (buffer + offset, readbuffer, 2048);
|
||||||
offset += 2048;
|
offset += 2048;
|
||||||
discoffset += 2048;
|
discoffset += 2048;
|
||||||
@ -676,12 +688,15 @@ LoadDVDFileOffset (unsigned char *buffer, int length)
|
|||||||
i = dvddirlength % 2048;
|
i = dvddirlength % 2048;
|
||||||
ret = dvd_read (readbuffer, 2048, discoffset);
|
ret = dvd_read (readbuffer, 2048, discoffset);
|
||||||
if(ret <= 0) // read failure
|
if(ret <= 0) // read failure
|
||||||
return 0;
|
goto done;
|
||||||
memcpy (buffer + offset, readbuffer, i);
|
memcpy (buffer + offset, readbuffer, i);
|
||||||
}
|
}
|
||||||
|
result = dvddirlength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dvddirlength;
|
done:
|
||||||
|
CancelAction();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -701,7 +716,7 @@ LoadDVDFile(char * buffer, char *filepath, int datasize, bool silent)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!silent)
|
if(!silent)
|
||||||
WaitPrompt("Error loading file!");
|
ErrorPrompt("Error loading file!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -727,7 +742,7 @@ void uselessinquiry ()
|
|||||||
dvd[6] = 0x20;
|
dvd[6] = 0x20;
|
||||||
dvd[7] = 1;
|
dvd[7] = 1;
|
||||||
|
|
||||||
while (dvd[7] & 1);
|
while (dvd[7] & 1) usleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -744,7 +759,7 @@ void dvd_motor_off ()
|
|||||||
dvd[5] = 0;
|
dvd[5] = 0;
|
||||||
dvd[6] = 0;
|
dvd[6] = 0;
|
||||||
dvd[7] = 1; // Do immediate
|
dvd[7] = 1; // Do immediate
|
||||||
while (dvd[7] & 1);
|
while (dvd[7] & 1) usleep(50);
|
||||||
|
|
||||||
/*** PSO Stops blackscreen at reload ***/
|
/*** PSO Stops blackscreen at reload ***/
|
||||||
dvd[0] = 0x14;
|
dvd[0] = 0x14;
|
||||||
@ -770,8 +785,8 @@ int dvd_driveid()
|
|||||||
dvd[6] = 0x20;
|
dvd[6] = 0x20;
|
||||||
dvd[7] = 3;
|
dvd[7] = 3;
|
||||||
|
|
||||||
while( dvd[7] & 1 )
|
while( dvd[7] & 1 ) usleep(50);
|
||||||
;
|
|
||||||
DCFlushRange((void *)0x80000000, 32);
|
DCFlushRange((void *)0x80000000, 32);
|
||||||
|
|
||||||
return (int)inquiry[2];
|
return (int)inquiry[2];
|
||||||
|
@ -25,6 +25,7 @@ int dvd_safe_read (void *dst, unsigned int len, u64 offset);
|
|||||||
void SetDVDDriveType();
|
void SetDVDDriveType();
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
void dvd_motor_off ();
|
void dvd_motor_off ();
|
||||||
|
void uselessinquiry ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* svpe June 2007
|
* svpe June 2007
|
||||||
* crunchy2 May-July 2007
|
* crunchy2 May-July 2007
|
||||||
* Michniewski 2008
|
* Michniewski 2008
|
||||||
* Tantric August 2008
|
* Tantric 2008-2009
|
||||||
*
|
*
|
||||||
* filesel.cpp
|
* filesel.cpp
|
||||||
*
|
*
|
||||||
@ -29,9 +29,10 @@ extern "C" {
|
|||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
|
|
||||||
|
#include "filebrowser.h"
|
||||||
#include "snes9xGX.h"
|
#include "snes9xGX.h"
|
||||||
#include "dvd.h"
|
#include "dvd.h"
|
||||||
#include "menudraw.h"
|
#include "menu.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "aram.h"
|
#include "aram.h"
|
||||||
#include "networkop.h"
|
#include "networkop.h"
|
||||||
@ -39,6 +40,10 @@ extern "C" {
|
|||||||
#include "memcardop.h"
|
#include "memcardop.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "gcunzip.h"
|
#include "gcunzip.h"
|
||||||
|
#include "cheatmgr.h"
|
||||||
|
#include "patch.h"
|
||||||
|
#include "freeze.h"
|
||||||
|
#include "sram.h"
|
||||||
|
|
||||||
BROWSERINFO browser;
|
BROWSERINFO browser;
|
||||||
BROWSERENTRY * browserList = NULL; // list of files/folders in browser
|
BROWSERENTRY * browserList = NULL; // list of files/folders in browser
|
||||||
@ -58,7 +63,7 @@ int autoLoadMethod()
|
|||||||
{
|
{
|
||||||
ShowAction ("Attempting to determine load method...");
|
ShowAction ("Attempting to determine load method...");
|
||||||
|
|
||||||
int method = 0;
|
int method = METHOD_AUTO;
|
||||||
|
|
||||||
if(ChangeInterface(METHOD_SD, SILENT))
|
if(ChangeInterface(METHOD_SD, SILENT))
|
||||||
method = METHOD_SD;
|
method = METHOD_SD;
|
||||||
@ -69,10 +74,11 @@ int autoLoadMethod()
|
|||||||
else if(ChangeInterface(METHOD_SMB, SILENT))
|
else if(ChangeInterface(METHOD_SMB, SILENT))
|
||||||
method = METHOD_SMB;
|
method = METHOD_SMB;
|
||||||
else
|
else
|
||||||
WaitPrompt("Unable to auto-determine load method!");
|
ErrorPrompt("Unable to auto-determine load method!");
|
||||||
|
|
||||||
if(GCSettings.LoadMethod == METHOD_AUTO)
|
if(GCSettings.LoadMethod == METHOD_AUTO)
|
||||||
GCSettings.LoadMethod = method; // save method found for later use
|
GCSettings.LoadMethod = method; // save method found for later use
|
||||||
|
CancelAction();
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,23 +92,25 @@ int autoSaveMethod(bool silent)
|
|||||||
if(!silent)
|
if(!silent)
|
||||||
ShowAction ("Attempting to determine save method...");
|
ShowAction ("Attempting to determine save method...");
|
||||||
|
|
||||||
int method = 0;
|
int method = METHOD_AUTO;
|
||||||
|
|
||||||
if(ChangeInterface(METHOD_SD, SILENT))
|
if(ChangeInterface(METHOD_SD, SILENT))
|
||||||
method = METHOD_SD;
|
method = METHOD_SD;
|
||||||
else if(ChangeInterface(METHOD_USB, SILENT))
|
else if(ChangeInterface(METHOD_USB, SILENT))
|
||||||
method = METHOD_USB;
|
method = METHOD_USB;
|
||||||
else if(TestCard(CARD_SLOTA, SILENT))
|
else if(ChangeInterface(METHOD_MC_SLOTA, SILENT))
|
||||||
method = METHOD_MC_SLOTA;
|
method = METHOD_MC_SLOTA;
|
||||||
else if(TestCard(CARD_SLOTB, SILENT))
|
else if(ChangeInterface(METHOD_MC_SLOTB, SILENT))
|
||||||
method = METHOD_MC_SLOTB;
|
method = METHOD_MC_SLOTB;
|
||||||
else if(ChangeInterface(METHOD_SMB, SILENT))
|
else if(ChangeInterface(METHOD_SMB, SILENT))
|
||||||
method = METHOD_SMB;
|
method = METHOD_SMB;
|
||||||
else if(!silent)
|
else if(!silent)
|
||||||
WaitPrompt("Unable to auto-determine save method!");
|
ErrorPrompt("Unable to auto-determine save method!");
|
||||||
|
|
||||||
if(GCSettings.SaveMethod == METHOD_AUTO)
|
if(GCSettings.SaveMethod == METHOD_AUTO)
|
||||||
GCSettings.SaveMethod = method; // save method found for later use
|
GCSettings.SaveMethod = method; // save method found for later use
|
||||||
|
|
||||||
|
CancelAction();
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +120,9 @@ int autoSaveMethod(bool silent)
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ResetBrowser()
|
void ResetBrowser()
|
||||||
{
|
{
|
||||||
browser.selIndex = browser.pageIndex = 0;
|
browser.numEntries = 0;
|
||||||
|
browser.selIndex = 0;
|
||||||
|
browser.pageIndex = 0;
|
||||||
|
|
||||||
// Clear any existing values
|
// Clear any existing values
|
||||||
if(browserList != NULL)
|
if(browserList != NULL)
|
||||||
@ -174,7 +184,7 @@ int UpdateDirName(int method)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WaitPrompt("Directory name is too long!");
|
ErrorPrompt("Directory name is too long!");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +201,7 @@ bool MakeFilePath(char filepath[], int type, int method)
|
|||||||
// Check path length
|
// Check path length
|
||||||
if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) >= MAXPATHLEN)
|
if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) >= MAXPATHLEN)
|
||||||
{
|
{
|
||||||
WaitPrompt("Maximum filepath length reached!");
|
ErrorPrompt("Maximum filepath length reached!");
|
||||||
filepath[0] = 0;
|
filepath[0] = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -277,13 +287,13 @@ int FileSortCallback(const void *f1, const void *f2)
|
|||||||
* first file inside
|
* first file inside
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
bool IsValidROM(int method)
|
static bool IsValidROM(int method)
|
||||||
{
|
{
|
||||||
// file size should be between 96K and 8MB
|
// file size should be between 96K and 8MB
|
||||||
if(browserList[browser.selIndex].length < (1024*96) ||
|
if(browserList[browser.selIndex].length < (1024*96) ||
|
||||||
browserList[browser.selIndex].length > (1024*1024*8))
|
browserList[browser.selIndex].length > Memory.MAX_ROM_SIZE)
|
||||||
{
|
{
|
||||||
WaitPrompt("Invalid file size!");
|
ErrorPrompt("Invalid file size!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +328,7 @@ bool IsValidROM(int method)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WaitPrompt("Unknown file type!");
|
ErrorPrompt("Unknown file type!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,306 +361,152 @@ void StripExt(char* returnstring, char * inputstring)
|
|||||||
{
|
{
|
||||||
char* loc_dot;
|
char* loc_dot;
|
||||||
|
|
||||||
strcpy (returnstring, inputstring);
|
strncpy (returnstring, inputstring, 255);
|
||||||
|
|
||||||
|
if(inputstring == NULL || strlen(inputstring) < 4)
|
||||||
|
return;
|
||||||
|
|
||||||
loc_dot = strrchr(returnstring,'.');
|
loc_dot = strrchr(returnstring,'.');
|
||||||
if (loc_dot != NULL)
|
if (loc_dot != NULL)
|
||||||
*loc_dot = 0; // strip file extension
|
*loc_dot = 0; // strip file extension
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
// 7z file - let's open it up to select a file inside
|
||||||
* FileSelector
|
int BrowserLoadSz(int method)
|
||||||
*
|
|
||||||
* Let user select a file from the listing
|
|
||||||
***************************************************************************/
|
|
||||||
int FileSelector (int method)
|
|
||||||
{
|
{
|
||||||
u32 p = 0;
|
char filepath[MAXPATHLEN];
|
||||||
u32 wp = 0;
|
memset(filepath, 0, MAXPATHLEN);
|
||||||
u32 ph = 0;
|
|
||||||
u32 wh = 0;
|
|
||||||
signed char gc_ay = 0;
|
|
||||||
signed char gc_sx = 0;
|
|
||||||
signed char wm_ay = 0;
|
|
||||||
signed char wm_sx = 0;
|
|
||||||
|
|
||||||
int haverom = 0;
|
// we'll store the 7z filepath for extraction later
|
||||||
int redraw = 1;
|
if(!MakeFilePath(szpath, FILE_ROM, method))
|
||||||
int selectit = 0;
|
return 0;
|
||||||
|
|
||||||
int scroll_delay = 0;
|
// add device to filepath
|
||||||
bool move_selection = 0;
|
sprintf(filepath, "%s%s", rootdir, szpath);
|
||||||
#define SCROLL_INITIAL_DELAY 15
|
memcpy(szpath, filepath, MAXPATHLEN);
|
||||||
#define SCROLL_LOOP_DELAY 2
|
|
||||||
|
|
||||||
while (haverom == 0)
|
int szfiles = SzParse(szpath, method);
|
||||||
{
|
if(szfiles)
|
||||||
if (redraw)
|
{
|
||||||
ShowFiles (browserList, browser.numEntries, browser.pageIndex, browser.selIndex);
|
browser.numEntries = szfiles;
|
||||||
redraw = 0;
|
inSz = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ErrorPrompt("Error opening archive!");
|
||||||
|
|
||||||
VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads
|
return szfiles;
|
||||||
|
}
|
||||||
|
|
||||||
gc_ay = PAD_StickY (0);
|
int BrowserLoadFile(int method)
|
||||||
gc_sx = PAD_SubStickX (0);
|
{
|
||||||
|
char filepath[1024];
|
||||||
|
int loaded = 0;
|
||||||
|
|
||||||
p = PAD_ButtonsDown (0);
|
// check that this is a valid ROM
|
||||||
ph = PAD_ButtonsHeld (0);
|
if(!IsValidROM(method))
|
||||||
#ifdef HW_RVL
|
goto done;
|
||||||
wm_ay = WPAD_Stick (0, 0, 1);
|
|
||||||
wm_sx = WPAD_Stick (0, 1, 0);
|
|
||||||
|
|
||||||
wp = WPAD_ButtonsDown (0);
|
// store the filename (w/o ext) - used for sram/freeze naming
|
||||||
wh = WPAD_ButtonsHeld (0);
|
StripExt(Memory.ROMFilename, browserList[browser.selIndex].filename);
|
||||||
#endif
|
|
||||||
|
|
||||||
/*** Check for exit combo ***/
|
SNESROMSize = 0;
|
||||||
if ( (gc_sx < -70) || (wm_sx < -70) || (wp & WPAD_BUTTON_HOME) || (wp & WPAD_CLASSIC_BUTTON_HOME) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/*** Check buttons, perform actions ***/
|
if(!inSz)
|
||||||
if ( (p & PAD_BUTTON_A) || selectit || (wp & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A)) )
|
{
|
||||||
|
if(!MakeFilePath(filepath, FILE_ROM, method))
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
SNESROMSize = LoadFile ((char *)Memory.ROM, filepath, browserList[browser.selIndex].length, method, NOTSILENT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (method)
|
||||||
{
|
{
|
||||||
if ( selectit )
|
case METHOD_DVD:
|
||||||
selectit = 0;
|
SNESROMSize = SzExtractFile(browserList[browser.selIndex].offset, (unsigned char *)Memory.ROM);
|
||||||
if (browserList[browser.selIndex].isdir) // This is directory
|
break;
|
||||||
{
|
default:
|
||||||
/* update current directory and set new entry list if directory has changed */
|
SNESROMSize = LoadSzFile(szpath, (unsigned char *)Memory.ROM);
|
||||||
int status;
|
break;
|
||||||
|
|
||||||
if(inSz && browser.selIndex == 0) // inside a 7z, requesting to leave
|
|
||||||
{
|
|
||||||
if(method == METHOD_DVD)
|
|
||||||
SetDVDdirectory(browserList[0].offset, browserList[0].length);
|
|
||||||
|
|
||||||
inSz = false;
|
|
||||||
status = 1;
|
|
||||||
SzClose();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
status = UpdateDirName(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status == 1) // ok, open directory
|
|
||||||
{
|
|
||||||
switch (method)
|
|
||||||
{
|
|
||||||
case METHOD_DVD:
|
|
||||||
browser.numEntries = ParseDVDdirectory();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
browser.numEntries = ParseDirectory();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!browser.numEntries)
|
|
||||||
{
|
|
||||||
WaitPrompt ("Error reading directory!");
|
|
||||||
haverom = 1; // quit menu
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (status == -1) // directory name too long
|
|
||||||
{
|
|
||||||
return 0; // quit menu
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // this is a file
|
|
||||||
{
|
|
||||||
// 7z file - let's open it up to select a file inside
|
|
||||||
if(IsSz())
|
|
||||||
{
|
|
||||||
// we'll store the 7z filepath for extraction later
|
|
||||||
if(!MakeFilePath(szpath, FILE_ROM, method))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// add device to filepath
|
|
||||||
char fullpath[1024];
|
|
||||||
sprintf(fullpath, "%s%s", rootdir, szpath);
|
|
||||||
strcpy(szpath, fullpath);
|
|
||||||
|
|
||||||
int szfiles = SzParse(szpath, method);
|
|
||||||
if(szfiles)
|
|
||||||
{
|
|
||||||
browser.numEntries = szfiles;
|
|
||||||
inSz = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
WaitPrompt("Error opening archive!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// check that this is a valid ROM
|
|
||||||
if(!IsValidROM(method))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// store the filename (w/o ext) - used for sram/freeze naming
|
|
||||||
StripExt(Memory.ROMFilename, browserList[browser.selIndex].filename);
|
|
||||||
|
|
||||||
ShowAction ("Loading...");
|
|
||||||
|
|
||||||
SNESROMSize = 0;
|
|
||||||
|
|
||||||
if(!inSz)
|
|
||||||
{
|
|
||||||
char filepath[1024];
|
|
||||||
|
|
||||||
if(!MakeFilePath(filepath, FILE_ROM, method))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
SNESROMSize = LoadFile ((char *)Memory.ROM, filepath, browserList[browser.selIndex].length, method, NOTSILENT);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (method)
|
|
||||||
{
|
|
||||||
case METHOD_DVD:
|
|
||||||
SNESROMSize = SzExtractFile(browserList[browser.selIndex].offset, (unsigned char *)Memory.ROM);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
SNESROMSize = LoadSzFile(szpath, (unsigned char *)Memory.ROM);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inSz = false;
|
|
||||||
|
|
||||||
if (SNESROMSize > 0)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
WaitPrompt("Error loading ROM!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
redraw = 1;
|
|
||||||
} // End of A
|
|
||||||
if ((p & PAD_BUTTON_B)
|
|
||||||
|| (wp & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B)))
|
|
||||||
{
|
|
||||||
while ((PAD_ButtonsDown(0) & PAD_BUTTON_B)
|
|
||||||
#ifdef HW_RVL
|
|
||||||
|| (WPAD_ButtonsDown(0) & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B))
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
VIDEO_WaitVSync();
|
|
||||||
if (strcmp(browserList[0].filename, "..") == 0)
|
|
||||||
{
|
|
||||||
browser.selIndex = 0;
|
|
||||||
selectit = 1;
|
|
||||||
}
|
|
||||||
else if (strcmp(browserList[1].filename, "..") == 0)
|
|
||||||
{
|
|
||||||
browser.selIndex = selectit = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} // End of B
|
|
||||||
if (((p | ph) & PAD_BUTTON_DOWN) || ((wp | wh) & (WPAD_BUTTON_DOWN
|
|
||||||
| WPAD_CLASSIC_BUTTON_DOWN)) || (gc_ay < -PADCAL) || (wm_ay
|
|
||||||
< -PADCAL))
|
|
||||||
{
|
|
||||||
if ((p & PAD_BUTTON_DOWN) || (wp & (WPAD_BUTTON_DOWN
|
|
||||||
| WPAD_CLASSIC_BUTTON_DOWN)))
|
|
||||||
{ /*** Button just pressed ***/
|
|
||||||
scroll_delay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
|
||||||
move_selection = 1; //continue (move selection)
|
|
||||||
}
|
|
||||||
else if (scroll_delay == 0)
|
|
||||||
{ /*** Button is held ***/
|
|
||||||
scroll_delay = SCROLL_LOOP_DELAY;
|
|
||||||
move_selection = 1; //continue (move selection)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scroll_delay--; // wait
|
|
||||||
}
|
|
||||||
|
|
||||||
if (move_selection)
|
|
||||||
{
|
|
||||||
browser.selIndex++;
|
|
||||||
if (browser.selIndex == browser.numEntries)
|
|
||||||
browser.selIndex = browser.pageIndex = 0;
|
|
||||||
if ((browser.selIndex - browser.pageIndex) >= PAGESIZE)
|
|
||||||
browser.pageIndex += PAGESIZE;
|
|
||||||
redraw = 1;
|
|
||||||
move_selection = 0;
|
|
||||||
}
|
|
||||||
} // End of down
|
|
||||||
if (((p | ph) & PAD_BUTTON_UP) || ((wp | wh) & (WPAD_BUTTON_UP
|
|
||||||
| WPAD_CLASSIC_BUTTON_UP)) || (gc_ay > PADCAL) || (wm_ay
|
|
||||||
> PADCAL))
|
|
||||||
{
|
|
||||||
if ((p & PAD_BUTTON_UP) || (wp & (WPAD_BUTTON_UP
|
|
||||||
| WPAD_CLASSIC_BUTTON_UP)))
|
|
||||||
{ /*** Button just pressed***/
|
|
||||||
scroll_delay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
|
||||||
move_selection = 1; //continue (move selection)
|
|
||||||
}
|
|
||||||
else if (scroll_delay == 0)
|
|
||||||
{ /*** Button is held ***/
|
|
||||||
scroll_delay = SCROLL_LOOP_DELAY;
|
|
||||||
move_selection = 1; //continue (move selection)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scroll_delay--; // wait
|
|
||||||
}
|
|
||||||
|
|
||||||
if (move_selection)
|
|
||||||
{
|
|
||||||
browser.selIndex--;
|
|
||||||
if (browser.selIndex < 0)
|
|
||||||
{
|
|
||||||
browser.selIndex = browser.numEntries - 1;
|
|
||||||
browser.pageIndex = browser.selIndex - PAGESIZE + 1;
|
|
||||||
}
|
|
||||||
if (browser.selIndex < browser.pageIndex)
|
|
||||||
browser.pageIndex -= PAGESIZE;
|
|
||||||
if (browser.pageIndex < 0)
|
|
||||||
browser.pageIndex = 0;
|
|
||||||
redraw = 1;
|
|
||||||
move_selection = 0;
|
|
||||||
}
|
|
||||||
} // End of Up
|
|
||||||
if ((p & PAD_BUTTON_LEFT) || (wp & (WPAD_BUTTON_LEFT
|
|
||||||
| WPAD_CLASSIC_BUTTON_LEFT)))
|
|
||||||
{
|
|
||||||
/*** Go back a page ***/
|
|
||||||
browser.selIndex -= PAGESIZE;
|
|
||||||
if (browser.selIndex < 0)
|
|
||||||
{
|
|
||||||
browser.selIndex = browser.numEntries - 1;
|
|
||||||
browser.pageIndex = browser.selIndex - PAGESIZE + 1;
|
|
||||||
}
|
|
||||||
if (browser.selIndex < browser.pageIndex)
|
|
||||||
browser.pageIndex -= PAGESIZE;
|
|
||||||
if (browser.pageIndex < 0)
|
|
||||||
browser.pageIndex = 0;
|
|
||||||
redraw = 1;
|
|
||||||
}
|
|
||||||
if ((p & PAD_BUTTON_RIGHT) || (wp & (WPAD_BUTTON_RIGHT
|
|
||||||
| WPAD_CLASSIC_BUTTON_RIGHT)))
|
|
||||||
{
|
|
||||||
/*** Go forward a page ***/
|
|
||||||
browser.selIndex += PAGESIZE;
|
|
||||||
if (browser.selIndex > browser.numEntries - 1)
|
|
||||||
browser.selIndex = browser.pageIndex = 0;
|
|
||||||
if ((browser.selIndex - browser.pageIndex) >= PAGESIZE)
|
|
||||||
browser.pageIndex += PAGESIZE;
|
|
||||||
redraw = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
inSz = false;
|
||||||
|
|
||||||
|
if (SNESROMSize <= 0)
|
||||||
|
{
|
||||||
|
ErrorPrompt("Error loading ROM!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// load UPS/IPS/PPF patch
|
||||||
|
LoadPatch(GCSettings.LoadMethod);
|
||||||
|
|
||||||
|
Memory.LoadROM ("BLANK.SMC");
|
||||||
|
Memory.LoadSRAM ("BLANK");
|
||||||
|
|
||||||
|
// load SRAM or snapshot
|
||||||
|
if (GCSettings.AutoLoad == 1)
|
||||||
|
LoadSRAMAuto(GCSettings.SaveMethod, SILENT);
|
||||||
|
else if (GCSettings.AutoLoad == 2)
|
||||||
|
NGCUnfreezeGameAuto(GCSettings.SaveMethod, SILENT);
|
||||||
|
|
||||||
|
// setup cheats
|
||||||
|
if(GCSettings.SaveMethod != METHOD_MC_SLOTA &&
|
||||||
|
GCSettings.SaveMethod != METHOD_MC_SLOTB)
|
||||||
|
SetupCheats();
|
||||||
|
|
||||||
|
ResetBrowser();
|
||||||
|
loaded = 1;
|
||||||
|
}
|
||||||
|
done:
|
||||||
|
CancelAction();
|
||||||
|
return loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update current directory and set new entry list if directory has changed */
|
||||||
|
int BrowserChangeFolder(int method)
|
||||||
|
{
|
||||||
|
if(inSz && browser.selIndex == 0) // inside a 7z, requesting to leave
|
||||||
|
{
|
||||||
|
if(method == METHOD_DVD)
|
||||||
|
SetDVDdirectory(browserList[0].offset, browserList[0].length);
|
||||||
|
|
||||||
|
inSz = false;
|
||||||
|
SzClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!UpdateDirName(method))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
switch (method)
|
||||||
|
{
|
||||||
|
case METHOD_DVD:
|
||||||
|
ParseDVDdirectory();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ParseDirectory();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!browser.numEntries)
|
||||||
|
{
|
||||||
|
ErrorPrompt("Error reading directory!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return browser.numEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* OpenROM
|
* OpenROM
|
||||||
* Opens device specified by method, displays a list of ROMS
|
* Displays a list of ROMS on load device
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
OpenROM (int method)
|
OpenGameList ()
|
||||||
{
|
{
|
||||||
|
int method = GCSettings.LoadMethod;
|
||||||
|
|
||||||
if(method == METHOD_AUTO)
|
if(method == METHOD_AUTO)
|
||||||
method = autoLoadMethod();
|
method = autoLoadMethod();
|
||||||
|
|
||||||
@ -661,26 +517,18 @@ OpenROM (int method)
|
|||||||
{
|
{
|
||||||
case METHOD_DVD:
|
case METHOD_DVD:
|
||||||
browser.dir[0] = 0;
|
browser.dir[0] = 0;
|
||||||
browser.numEntries = ParseDVDdirectory(); // Parse root directory
|
ParseDVDdirectory(); // Parse root directory
|
||||||
SwitchDVDFolder(GCSettings.LoadFolder); // switch to ROM folder
|
SwitchDVDFolder(GCSettings.LoadFolder); // switch to ROM folder
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(browser.dir, "/%s", GCSettings.LoadFolder);
|
sprintf(browser.dir, "/%s", GCSettings.LoadFolder);
|
||||||
browser.numEntries = ParseDirectory(); // Parse root directory
|
ParseDirectory(); // Parse root directory
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.numEntries > 0)
|
|
||||||
{
|
|
||||||
// Select an entry
|
|
||||||
return FileSelector (method);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// no entries found
|
|
||||||
WaitPrompt ("No Files Found!");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
else
|
||||||
|
{
|
||||||
|
ResetBrowser();
|
||||||
|
}
|
||||||
|
return browser.numEntries;
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May 2007
|
* crunchy2 May 2007
|
||||||
* Michniewski 2008
|
* Michniewski 2008
|
||||||
* Tantric August 2008
|
* Tantric 2008-2009
|
||||||
*
|
*
|
||||||
* filesel.h
|
* filesel.h
|
||||||
*
|
*
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
|
|
||||||
#define MAXJOLIET 255
|
#define MAXJOLIET 255
|
||||||
#define MAXDISPLAY 50
|
#define MAXDISPLAY 35
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -32,6 +32,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
u64 offset; // DVD offset
|
u64 offset; // DVD offset
|
||||||
unsigned int length; // file length
|
unsigned int length; // file length
|
||||||
|
tm mtime; // file modified time
|
||||||
char isdir; // 0 - file, 1 - directory
|
char isdir; // 0 - file, 1 - directory
|
||||||
char filename[MAXJOLIET + 1]; // full filename
|
char filename[MAXJOLIET + 1]; // full filename
|
||||||
char displayname[MAXDISPLAY + 1]; // name for browser display
|
char displayname[MAXDISPLAY + 1]; // name for browser display
|
||||||
@ -44,11 +45,16 @@ extern char rootdir[10];
|
|||||||
extern unsigned long SNESROMSize;
|
extern unsigned long SNESROMSize;
|
||||||
|
|
||||||
bool MakeFilePath(char filepath[], int type, int method);
|
bool MakeFilePath(char filepath[], int type, int method);
|
||||||
int OpenROM (int method);
|
int UpdateDirName(int method);
|
||||||
|
int OpenGameList();
|
||||||
int autoLoadMethod();
|
int autoLoadMethod();
|
||||||
int autoSaveMethod(bool silent);
|
int autoSaveMethod(bool silent);
|
||||||
int FileSortCallback(const void *f1, const void *f2);
|
int FileSortCallback(const void *f1, const void *f2);
|
||||||
void StripExt(char* returnstring, char * inputstring);
|
void StripExt(char* returnstring, char * inputstring);
|
||||||
|
bool IsSz();
|
||||||
void ResetBrowser();
|
void ResetBrowser();
|
||||||
|
int BrowserLoadSz(int method);
|
||||||
|
int BrowserChangeFolder(int method);
|
||||||
|
int BrowserLoadFile(int method);
|
||||||
|
|
||||||
#endif
|
#endif
|
193
source/ngc/filelist.h
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric January 2009
|
||||||
|
*
|
||||||
|
* imagelist.h
|
||||||
|
*
|
||||||
|
* Contains a list of all of the images in the images/ folder
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _FILELIST_H_
|
||||||
|
#define _FILELIST_H_
|
||||||
|
|
||||||
|
#include <gccore.h>
|
||||||
|
|
||||||
|
extern const u8 font_ttf[];
|
||||||
|
extern const u32 font_ttf_size;
|
||||||
|
|
||||||
|
extern const u8 bg_music_ogg[];
|
||||||
|
extern const u32 bg_music_ogg_size;
|
||||||
|
|
||||||
|
extern const u8 button_over_pcm[];
|
||||||
|
extern const u32 button_over_pcm_size;
|
||||||
|
|
||||||
|
extern const u8 bg_top_png[];
|
||||||
|
extern const u32 bg_top_png_size;
|
||||||
|
|
||||||
|
extern const u8 bg_bottom_png[];
|
||||||
|
extern const u32 bg_bottom_png_size;
|
||||||
|
|
||||||
|
extern const u8 icon_settings_png[];
|
||||||
|
extern const u32 icon_settings_png_size;
|
||||||
|
|
||||||
|
extern const u8 icon_home_png[];
|
||||||
|
extern const u32 icon_home_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_png[];
|
||||||
|
extern const u32 button_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_over_png[];
|
||||||
|
extern const u32 button_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_arrow_left_png[];
|
||||||
|
extern const u32 button_arrow_left_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_arrow_right_png[];
|
||||||
|
extern const u32 button_arrow_right_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_arrow_up_png[];
|
||||||
|
extern const u32 button_arrow_up_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_arrow_down_png[];
|
||||||
|
extern const u32 button_arrow_down_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_arrow_left_over_png[];
|
||||||
|
extern const u32 button_arrow_left_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_arrow_right_over_png[];
|
||||||
|
extern const u32 button_arrow_right_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_arrow_up_over_png[];
|
||||||
|
extern const u32 button_arrow_up_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_arrow_down_over_png[];
|
||||||
|
extern const u32 button_arrow_down_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_close_png[];
|
||||||
|
extern const u32 button_close_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_close_over_png[];
|
||||||
|
extern const u32 button_close_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_large_png[];
|
||||||
|
extern const u32 button_large_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_large_over_png[];
|
||||||
|
extern const u32 button_large_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_gamesave_png[];
|
||||||
|
extern const u32 button_gamesave_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_gamesave_over_png[];
|
||||||
|
extern const u32 button_gamesave_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 button_gamesave_blank_png[];
|
||||||
|
extern const u32 button_gamesave_blank_png_size;
|
||||||
|
|
||||||
|
extern const u8 screen_position_png[];
|
||||||
|
extern const u32 screen_position_png_size;
|
||||||
|
|
||||||
|
extern const u8 dialogue_box_png[];
|
||||||
|
extern const u32 dialogue_box_png_size;
|
||||||
|
|
||||||
|
extern const u8 progressbar_png[];
|
||||||
|
extern const u32 progressbar_png_size;
|
||||||
|
|
||||||
|
extern const u8 progressbar_empty_png[];
|
||||||
|
extern const u32 progressbar_empty_png_size;
|
||||||
|
|
||||||
|
extern const u8 progressbar_outline_png[];
|
||||||
|
extern const u32 progressbar_outline_png_size;
|
||||||
|
|
||||||
|
extern const u8 throbber_png[];
|
||||||
|
extern const u32 throbber_png_size;
|
||||||
|
|
||||||
|
extern const u8 folder_png[];
|
||||||
|
extern const u32 folder_png_size;
|
||||||
|
|
||||||
|
extern const u8 battery_png[];
|
||||||
|
extern const u32 battery_png_size;
|
||||||
|
|
||||||
|
extern const u8 battery_bar_png[];
|
||||||
|
extern const u32 battery_bar_png_size;
|
||||||
|
|
||||||
|
extern const u8 bg_options_png[];
|
||||||
|
extern const u32 bg_options_png_size;
|
||||||
|
|
||||||
|
extern const u8 bg_options_entry_png[];
|
||||||
|
extern const u32 bg_options_entry_png_size;
|
||||||
|
|
||||||
|
extern const u8 bg_game_selection_png[];
|
||||||
|
extern const u32 bg_game_selection_png_size;
|
||||||
|
|
||||||
|
extern const u8 bg_game_selection_entry_png[];
|
||||||
|
extern const u32 bg_game_selection_entry_png_size;
|
||||||
|
|
||||||
|
extern const u8 scrollbar_png[];
|
||||||
|
extern const u32 scrollbar_png_size;
|
||||||
|
|
||||||
|
extern const u8 scrollbar_arrowup_png[];
|
||||||
|
extern const u32 scrollbar_arrowup_png_size;
|
||||||
|
|
||||||
|
extern const u8 scrollbar_arrowup_over_png[];
|
||||||
|
extern const u32 scrollbar_arrowup_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 scrollbar_arrowdown_png[];
|
||||||
|
extern const u32 scrollbar_arrowdown_png_size;
|
||||||
|
|
||||||
|
extern const u8 scrollbar_arrowdown_over_png[];
|
||||||
|
extern const u32 scrollbar_arrowdown_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 scrollbar_box_png[];
|
||||||
|
extern const u32 scrollbar_box_png_size;
|
||||||
|
|
||||||
|
extern const u8 scrollbar_box_over_png[];
|
||||||
|
extern const u32 scrollbar_box_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 keyboard_textbox_png[];
|
||||||
|
extern const u32 keyboard_textbox_png_size;
|
||||||
|
|
||||||
|
extern const u8 keyboard_key_png[];
|
||||||
|
extern const u32 keyboard_key_png_size;
|
||||||
|
|
||||||
|
extern const u8 keyboard_key_over_png[];
|
||||||
|
extern const u32 keyboard_key_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 keyboard_mediumkey_png[];
|
||||||
|
extern const u32 keyboard_mediumkey_png_size;
|
||||||
|
|
||||||
|
extern const u8 keyboard_mediumkey_over_png[];
|
||||||
|
extern const u32 keyboard_mediumkey_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 keyboard_largekey_png[];
|
||||||
|
extern const u32 keyboard_largekey_png_size;
|
||||||
|
|
||||||
|
extern const u8 keyboard_largekey_over_png[];
|
||||||
|
extern const u32 keyboard_largekey_over_png_size;
|
||||||
|
|
||||||
|
extern const u8 player1_point_png[];
|
||||||
|
extern const u32 player1_point_png_size;
|
||||||
|
|
||||||
|
extern const u8 player2_point_png[];
|
||||||
|
extern const u32 player2_point_png_size;
|
||||||
|
|
||||||
|
extern const u8 player3_point_png[];
|
||||||
|
extern const u32 player3_point_png_size;
|
||||||
|
|
||||||
|
extern const u8 player4_point_png[];
|
||||||
|
extern const u32 player4_point_png_size;
|
||||||
|
|
||||||
|
extern const u8 player1_grab_png[];
|
||||||
|
extern const u32 player1_grab_png_size;
|
||||||
|
|
||||||
|
extern const u8 player2_grab_png[];
|
||||||
|
extern const u32 player2_grab_png_size;
|
||||||
|
|
||||||
|
extern const u8 player3_grab_png[];
|
||||||
|
extern const u32 player3_grab_png_size;
|
||||||
|
|
||||||
|
extern const u8 player4_grab_png[];
|
||||||
|
extern const u32 player4_grab_png_size;
|
||||||
|
|
||||||
|
#endif
|
@ -4,7 +4,7 @@
|
|||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May 2007
|
* crunchy2 May 2007
|
||||||
* Michniewski 2008
|
* Michniewski 2008
|
||||||
* Tantric August 2008
|
* Tantric 2008-2009
|
||||||
*
|
*
|
||||||
* fileop.cpp
|
* fileop.cpp
|
||||||
*
|
*
|
||||||
@ -31,8 +31,8 @@
|
|||||||
#include "memcardop.h"
|
#include "memcardop.h"
|
||||||
#include "gcunzip.h"
|
#include "gcunzip.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "menudraw.h"
|
#include "menu.h"
|
||||||
#include "filesel.h"
|
#include "filebrowser.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
|
||||||
unsigned char * savebuffer = NULL;
|
unsigned char * savebuffer = NULL;
|
||||||
@ -127,11 +127,11 @@ InitDeviceThread()
|
|||||||
void UnmountAllFAT()
|
void UnmountAllFAT()
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
fatUnmount("sd:/");
|
fatUnmount("sd:");
|
||||||
fatUnmount("usb:/");
|
fatUnmount("usb:");
|
||||||
#else
|
#else
|
||||||
fatUnmount("carda:/");
|
fatUnmount("carda:");
|
||||||
fatUnmount("cardb:/");
|
fatUnmount("cardb:");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ bool MountFAT(int method)
|
|||||||
return false; // unknown device
|
return false; // unknown device
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(rootdir, "%s:/", name);
|
sprintf(rootdir, "%s:", name);
|
||||||
|
|
||||||
if(unmountRequired[method])
|
if(unmountRequired[method])
|
||||||
{
|
{
|
||||||
@ -228,7 +228,7 @@ bool ChangeInterface(int method, bool silent)
|
|||||||
mounted = MountFAT(METHOD_SD_SLOTB); // try SD Gecko on slot B
|
mounted = MountFAT(METHOD_SD_SLOTB); // try SD Gecko on slot B
|
||||||
#endif
|
#endif
|
||||||
if(!mounted && !silent) // no SD device found
|
if(!mounted && !silent) // no SD device found
|
||||||
WaitPrompt ("SD card not found!");
|
ErrorPrompt("SD card not found!");
|
||||||
}
|
}
|
||||||
else if(method == METHOD_USB)
|
else if(method == METHOD_USB)
|
||||||
{
|
{
|
||||||
@ -236,21 +236,31 @@ bool ChangeInterface(int method, bool silent)
|
|||||||
mounted = MountFAT(method);
|
mounted = MountFAT(method);
|
||||||
|
|
||||||
if(!mounted && !silent)
|
if(!mounted && !silent)
|
||||||
WaitPrompt ("USB drive not found!");
|
ErrorPrompt("USB drive not found!");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if(method == METHOD_DVD)
|
else if(method == METHOD_DVD)
|
||||||
{
|
{
|
||||||
sprintf(rootdir, "/");
|
rootdir[0] = 0;
|
||||||
mounted = MountDVD(silent);
|
mounted = MountDVD(silent);
|
||||||
}
|
}
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
else if(method == METHOD_SMB)
|
else if(method == METHOD_SMB)
|
||||||
{
|
{
|
||||||
sprintf(rootdir, "smb:/");
|
sprintf(rootdir, "smb:");
|
||||||
mounted = ConnectShare(silent);
|
mounted = ConnectShare(silent);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
else if(method == METHOD_MC_SLOTA)
|
||||||
|
{
|
||||||
|
rootdir[0] = 0;
|
||||||
|
mounted = TestMC(CARD_SLOTA, silent);
|
||||||
|
}
|
||||||
|
else if(method == METHOD_MC_SLOTB)
|
||||||
|
{
|
||||||
|
rootdir[0] = 0;
|
||||||
|
mounted = TestMC(CARD_SLOTB, silent);
|
||||||
|
}
|
||||||
|
|
||||||
return mounted;
|
return mounted;
|
||||||
}
|
}
|
||||||
@ -266,8 +276,11 @@ ParseDirectory()
|
|||||||
char filename[MAXPATHLEN];
|
char filename[MAXPATHLEN];
|
||||||
char tmpname[MAXPATHLEN];
|
char tmpname[MAXPATHLEN];
|
||||||
struct stat filestat;
|
struct stat filestat;
|
||||||
|
struct tm * timeinfo;
|
||||||
char msg[128];
|
char msg[128];
|
||||||
|
|
||||||
|
ShowAction("Loading...");
|
||||||
|
|
||||||
// reset browser
|
// reset browser
|
||||||
ResetBrowser();
|
ResetBrowser();
|
||||||
|
|
||||||
@ -280,7 +293,7 @@ ParseDirectory()
|
|||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
{
|
{
|
||||||
sprintf(msg, "Error opening %s", fulldir);
|
sprintf(msg, "Error opening %s", fulldir);
|
||||||
WaitPrompt(msg);
|
ErrorPrompt(msg);
|
||||||
|
|
||||||
// if we can't open the dir, open root dir
|
// if we can't open the dir, open root dir
|
||||||
sprintf(browser.dir,"/");
|
sprintf(browser.dir,"/");
|
||||||
@ -290,8 +303,8 @@ ParseDirectory()
|
|||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
{
|
{
|
||||||
sprintf(msg, "Error opening %s", rootdir);
|
sprintf(msg, "Error opening %s", rootdir);
|
||||||
WaitPrompt(msg);
|
ErrorPrompt(msg);
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,8 +320,8 @@ ParseDirectory()
|
|||||||
if(!newBrowserList) // failed to allocate required memory
|
if(!newBrowserList) // failed to allocate required memory
|
||||||
{
|
{
|
||||||
ResetBrowser();
|
ResetBrowser();
|
||||||
WaitPrompt("Out of memory: too many files!");
|
ErrorPrompt("Out of memory: too many files!");
|
||||||
entryNum = 0;
|
entryNum = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -321,6 +334,8 @@ ParseDirectory()
|
|||||||
StripExt(tmpname, filename); // hide file extension
|
StripExt(tmpname, filename); // hide file extension
|
||||||
strncpy(browserList[entryNum].displayname, tmpname, MAXDISPLAY); // crop name for display
|
strncpy(browserList[entryNum].displayname, tmpname, MAXDISPLAY); // crop name for display
|
||||||
browserList[entryNum].length = filestat.st_size;
|
browserList[entryNum].length = filestat.st_size;
|
||||||
|
timeinfo = localtime (&filestat.st_mtime);
|
||||||
|
memcpy(&browserList[entryNum].mtime, timeinfo, sizeof(tm));
|
||||||
browserList[entryNum].isdir = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1; // flag this as a dir
|
browserList[entryNum].isdir = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1; // flag this as a dir
|
||||||
|
|
||||||
entryNum++;
|
entryNum++;
|
||||||
@ -333,6 +348,9 @@ ParseDirectory()
|
|||||||
// Sort the file list
|
// Sort the file list
|
||||||
qsort(browserList, entryNum, sizeof(BROWSERENTRY), FileSortCallback);
|
qsort(browserList, entryNum, sizeof(BROWSERENTRY), FileSortCallback);
|
||||||
|
|
||||||
|
CancelAction();
|
||||||
|
|
||||||
|
browser.numEntries = entryNum;
|
||||||
return entryNum;
|
return entryNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,6 +381,39 @@ FreeSaveBuffer ()
|
|||||||
savebuffer = NULL;
|
savebuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* FindBufferSize()
|
||||||
|
* Finds the position of the last bit written to the buffer
|
||||||
|
* This function isn't perfect, but it should get the job done
|
||||||
|
***************************************************************************/
|
||||||
|
int FindBufferSize(char * buffer, int maxsize)
|
||||||
|
{
|
||||||
|
int datasize = maxsize; // we'll start at the max size
|
||||||
|
|
||||||
|
char check = buffer[datasize];
|
||||||
|
while(check == 0)
|
||||||
|
{
|
||||||
|
datasize -= 16384;
|
||||||
|
check = buffer[datasize];
|
||||||
|
}
|
||||||
|
datasize += 16384;
|
||||||
|
check = buffer[datasize];
|
||||||
|
while(check == 0)
|
||||||
|
{
|
||||||
|
datasize -= 1024;
|
||||||
|
check = buffer[datasize];
|
||||||
|
}
|
||||||
|
datasize += 1024;
|
||||||
|
check = buffer[datasize];
|
||||||
|
while(check == 0)
|
||||||
|
{
|
||||||
|
datasize -= 1;
|
||||||
|
check = buffer[datasize];
|
||||||
|
}
|
||||||
|
datasize += 2; // include last byte AND a null byte
|
||||||
|
return datasize;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* LoadSzFile
|
* LoadSzFile
|
||||||
* Loads the selected file # from the specified 7z into rbuffer
|
* Loads the selected file # from the specified 7z into rbuffer
|
||||||
@ -385,7 +436,7 @@ LoadSzFile(char * filepath, unsigned char * rbuffer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WaitPrompt("Error opening file");
|
ErrorPrompt("Error opening file");
|
||||||
}
|
}
|
||||||
|
|
||||||
// go back to checking if devices were inserted/removed
|
// go back to checking if devices were inserted/removed
|
||||||
@ -404,7 +455,7 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent)
|
|||||||
u32 size = 0;
|
u32 size = 0;
|
||||||
u32 readsize = 0;
|
u32 readsize = 0;
|
||||||
|
|
||||||
if(!ChangeInterface(method, NOTSILENT))
|
if(!ChangeInterface(method, silent))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch(method)
|
switch(method)
|
||||||
@ -466,6 +517,7 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent)
|
|||||||
if(readsize > 0)
|
if(readsize > 0)
|
||||||
offset += readsize;
|
offset += readsize;
|
||||||
}
|
}
|
||||||
|
CancelAction();
|
||||||
|
|
||||||
if(offset != size) // # bytes read doesn't match # expected
|
if(offset != size) // # bytes read doesn't match # expected
|
||||||
size = 0;
|
size = 0;
|
||||||
@ -477,16 +529,16 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent)
|
|||||||
if(!size && !silent)
|
if(!size && !silent)
|
||||||
{
|
{
|
||||||
unmountRequired[method] = true;
|
unmountRequired[method] = true;
|
||||||
WaitPrompt("Error loading file!");
|
ErrorPrompt("Error loading file!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// go back to checking if devices were inserted/removed
|
// go back to checking if devices were inserted/removed
|
||||||
LWP_ResumeThread (devicethread);
|
LWP_ResumeThread (devicethread);
|
||||||
|
CancelAction();
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 LoadFile(char filepath[], int method, bool silent)
|
u32 LoadFile(char * filepath, int method, bool silent)
|
||||||
{
|
{
|
||||||
return LoadFile((char *)savebuffer, filepath, 0, method, silent);
|
return LoadFile((char *)savebuffer, filepath, 0, method, silent);
|
||||||
}
|
}
|
||||||
@ -500,9 +552,11 @@ SaveFile (char * buffer, char *filepath, u32 datasize, int method, bool silent)
|
|||||||
{
|
{
|
||||||
u32 written = 0;
|
u32 written = 0;
|
||||||
|
|
||||||
if(!ChangeInterface(method, NOTSILENT))
|
if(!ChangeInterface(method, silent))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
ShowAction("Saving...");
|
||||||
|
|
||||||
switch(method)
|
switch(method)
|
||||||
{
|
{
|
||||||
case METHOD_MC_SLOTA:
|
case METHOD_MC_SLOTA:
|
||||||
@ -535,16 +589,17 @@ SaveFile (char * buffer, char *filepath, u32 datasize, int method, bool silent)
|
|||||||
if(!written && !silent)
|
if(!written && !silent)
|
||||||
{
|
{
|
||||||
unmountRequired[method] = true;
|
unmountRequired[method] = true;
|
||||||
WaitPrompt ("Error saving file!");
|
ErrorPrompt("Error saving file!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// go back to checking if devices were inserted/removed
|
// go back to checking if devices were inserted/removed
|
||||||
LWP_ResumeThread (devicethread);
|
LWP_ResumeThread (devicethread);
|
||||||
}
|
}
|
||||||
|
CancelAction();
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 SaveFile(char filepath[], u32 datasize, int method, bool silent)
|
u32 SaveFile(char * filepath, u32 datasize, int method, bool silent)
|
||||||
{
|
{
|
||||||
return SaveFile((char *)savebuffer, filepath, datasize, method, silent);
|
return SaveFile((char *)savebuffer, filepath, datasize, method, silent);
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,12 @@ bool ChangeInterface(int method, bool silent);
|
|||||||
int ParseDirectory();
|
int ParseDirectory();
|
||||||
void AllocSaveBuffer();
|
void AllocSaveBuffer();
|
||||||
void FreeSaveBuffer();
|
void FreeSaveBuffer();
|
||||||
|
int FindBufferSize(char * buffer, int maxsize);
|
||||||
u32 LoadFile(char * rbuffer, char *filepath, u32 length, int method, bool silent);
|
u32 LoadFile(char * rbuffer, char *filepath, u32 length, int method, bool silent);
|
||||||
u32 LoadFile(char filepath[], int method, bool silent);
|
u32 LoadFile(char * filepath, int method, bool silent);
|
||||||
u32 LoadSzFile(char * filepath, unsigned char * rbuffer);
|
u32 LoadSzFile(char * filepath, unsigned char * rbuffer);
|
||||||
u32 SaveFile(char * buffer, char *filepath, u32 datasize, int method, bool silent);
|
u32 SaveFile(char * buffer, char *filepath, u32 datasize, int method, bool silent);
|
||||||
u32 SaveFile(char filepath[], u32 datasize, int method, bool silent);
|
u32 SaveFile(char * filepath, u32 datasize, int method, bool silent);
|
||||||
|
|
||||||
extern unsigned char * savebuffer;
|
extern unsigned char * savebuffer;
|
||||||
extern FILE * file;
|
extern FILE * file;
|
||||||
|
@ -24,13 +24,13 @@
|
|||||||
#include "snes9xGX.h"
|
#include "snes9xGX.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
|
|
||||||
#include "menudraw.h"
|
#include "menu.h"
|
||||||
|
|
||||||
#define NUMBITS (16)
|
#define NUMBITS (16)
|
||||||
|
|
||||||
static int RGBtoYUV[1<<NUMBITS];
|
static int RGBtoYUV[1<<NUMBITS];
|
||||||
static uint16 RGBtoBright[1<<NUMBITS];
|
static uint16 RGBtoBright[1<<NUMBITS];
|
||||||
|
|
||||||
TFilterMethod FilterMethod = RenderPlain;
|
TFilterMethod FilterMethod = RenderPlain;
|
||||||
//TFilterMethod FilterMethodHiRes = RenderPlain;
|
//TFilterMethod FilterMethodHiRes = RenderPlain;
|
||||||
|
|
||||||
@ -96,11 +96,11 @@ int GetFilterScale(RenderFilter filterID)
|
|||||||
void
|
void
|
||||||
SelectFilterMethod ()
|
SelectFilterMethod ()
|
||||||
{
|
{
|
||||||
//WaitPrompt ((char*)"Select Filter Method."); // debug
|
//InfoPrompt((char*)"Select Filter Method."); // debug
|
||||||
|
|
||||||
FilterMethod = FilterToMethod((RenderFilter)GCSettings.FilterMethod);
|
FilterMethod = FilterToMethod((RenderFilter)GCSettings.FilterMethod);
|
||||||
//FilterMethodHiRes = FilterToMethod((RenderFilter)GCSettings.FilterMethodHiRes);
|
//FilterMethodHiRes = FilterToMethod((RenderFilter)GCSettings.FilterMethodHiRes);
|
||||||
|
|
||||||
// check whether or not we need filter memory (alloc or free it)
|
// check whether or not we need filter memory (alloc or free it)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ RenderPlain (uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int
|
|||||||
{
|
{
|
||||||
if (dstPtr == NULL)
|
if (dstPtr == NULL)
|
||||||
{
|
{
|
||||||
WaitPrompt((char*)"dstPtr is NULL. exiting!");
|
ErrorPrompt((char*)"dstPtr is NULL. exiting!");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
//memcpy (dstPtr, srcPtr, width*height*srcPitch);
|
//memcpy (dstPtr, srcPtr, width*height*srcPitch);
|
||||||
@ -427,7 +427,7 @@ void RenderHQ2X (uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||||||
//RenderSimple2X (Src, Dst, rect);
|
//RenderSimple2X (Src, Dst, rect);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w1, w2, w3, w4, w5, w6, w7, w8, w9;
|
int w1, w2, w3, w4, w5, w6, w7, w8, w9;
|
||||||
|
|
||||||
uint32 src1line = srcPitch >> 1;
|
uint32 src1line = srcPitch >> 1;
|
||||||
|
@ -43,7 +43,7 @@ typedef void (*TFilterMethod)(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uin
|
|||||||
extern TFilterMethod FilterMethod;
|
extern TFilterMethod FilterMethod;
|
||||||
extern TFilterMethod FilterMethodHiRes;
|
extern TFilterMethod FilterMethodHiRes;
|
||||||
|
|
||||||
extern unsigned char filtermem[];
|
extern unsigned char * filtermem;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prototypes
|
// Prototypes
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
# Fonts
|
|
||||||
|
|
||||||
.rodata
|
|
||||||
.globl fontface
|
|
||||||
.balign 32
|
|
||||||
fontface:
|
|
||||||
.incbin "../source/ngc/ttf/font.ttf"
|
|
||||||
|
|
||||||
|
|
||||||
.globl fontsize
|
|
||||||
fontsize: .long 28736
|
|
||||||
|
|
BIN
source/ngc/fonts/font.ttf
Normal file
@ -4,7 +4,7 @@
|
|||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May 2007-July 2007
|
* crunchy2 May 2007-July 2007
|
||||||
* Michniewski 2008
|
* Michniewski 2008
|
||||||
* Tantric August 2008
|
* Tantric 2008-2009
|
||||||
*
|
*
|
||||||
* freeze.cpp
|
* freeze.cpp
|
||||||
*
|
*
|
||||||
@ -22,6 +22,8 @@
|
|||||||
#include <fat.h>
|
#include <fat.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
|
#include "pngu/pngu.h"
|
||||||
|
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
#include "soundux.h"
|
#include "soundux.h"
|
||||||
@ -32,7 +34,9 @@
|
|||||||
#include "images/saveicon.h"
|
#include "images/saveicon.h"
|
||||||
#include "freeze.h"
|
#include "freeze.h"
|
||||||
#include "fileop.h"
|
#include "fileop.h"
|
||||||
#include "menudraw.h"
|
#include "filebrowser.h"
|
||||||
|
#include "menu.h"
|
||||||
|
#include "video.h"
|
||||||
|
|
||||||
extern void S9xSRTCPreSaveState ();
|
extern void S9xSRTCPreSaveState ();
|
||||||
extern void NGCFreezeStruct ();
|
extern void NGCFreezeStruct ();
|
||||||
@ -118,19 +122,16 @@ NGCFreezeMemBuffer ()
|
|||||||
* Do freeze game for Nintendo Gamecube
|
* Do freeze game for Nintendo Gamecube
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int
|
int
|
||||||
NGCFreezeGame (int method, bool silent)
|
NGCFreezeGame (char * filepath, int method, bool silent)
|
||||||
{
|
{
|
||||||
char filepath[1024];
|
|
||||||
int offset = 0; // bytes written (actual)
|
int offset = 0; // bytes written (actual)
|
||||||
int woffset = 0; // bytes written (expected)
|
int woffset = 0; // bytes written (expected)
|
||||||
char msg[100];
|
char msg[100];
|
||||||
|
|
||||||
ShowAction ("Saving...");
|
|
||||||
|
|
||||||
if(method == METHOD_AUTO)
|
if(method == METHOD_AUTO)
|
||||||
method = autoSaveMethod(silent);
|
method = autoSaveMethod(silent);
|
||||||
|
|
||||||
if(!MakeFilePath(filepath, FILE_SNAPSHOT, method))
|
if(method == METHOD_AUTO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
S9xSetSoundMute (TRUE);
|
S9xSetSoundMute (TRUE);
|
||||||
@ -165,8 +166,8 @@ NGCFreezeGame (int method, bool silent)
|
|||||||
if(err!=Z_OK)
|
if(err!=Z_OK)
|
||||||
{
|
{
|
||||||
sprintf (msg, "zip error %s ",zError(err));
|
sprintf (msg, "zip error %s ",zError(err));
|
||||||
WaitPrompt (msg);
|
ErrorPrompt(msg);
|
||||||
return 0;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
int zippedsize = (int)DestBuffSize;
|
int zippedsize = (int)DestBuffSize;
|
||||||
@ -182,17 +183,56 @@ NGCFreezeGame (int method, bool silent)
|
|||||||
|
|
||||||
offset = SaveFile(filepath, woffset, method, silent);
|
offset = SaveFile(filepath, woffset, method, silent);
|
||||||
|
|
||||||
|
done:
|
||||||
|
|
||||||
FreeSaveBuffer ();
|
FreeSaveBuffer ();
|
||||||
|
|
||||||
|
// save screenshot - I would prefer to do this from gameScreenTex
|
||||||
|
if(gameScreenTex != NULL && method != METHOD_MC_SLOTA && method != METHOD_MC_SLOTB)
|
||||||
|
{
|
||||||
|
AllocSaveBuffer ();
|
||||||
|
|
||||||
|
IMGCTX pngContext = PNGU_SelectImageFromBuffer(savebuffer);
|
||||||
|
|
||||||
|
if (pngContext != NULL)
|
||||||
|
{
|
||||||
|
PNGU_EncodeFromGXTexture(pngContext, 640, 480, gameScreenTex, 0);
|
||||||
|
PNGU_ReleaseImageContext(pngContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
int size = FindBufferSize((char *)savebuffer, 128*1024);
|
||||||
|
if(size > 0)
|
||||||
|
{
|
||||||
|
char screenpath[1024];
|
||||||
|
filepath[strlen(filepath)-4] = 0;
|
||||||
|
sprintf(screenpath, "%s.png", filepath);
|
||||||
|
SaveFile(screenpath, size, method, silent);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeSaveBuffer ();
|
||||||
|
}
|
||||||
|
|
||||||
if(offset > 0) // save successful!
|
if(offset > 0) // save successful!
|
||||||
{
|
{
|
||||||
if(!silent)
|
if(!silent)
|
||||||
WaitPrompt("Save successful");
|
InfoPrompt("Save successful");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
NGCFreezeGameAuto (int method, bool silent)
|
||||||
|
{
|
||||||
|
char filepath[1024];
|
||||||
|
|
||||||
|
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
|
||||||
|
sprintf(filepath, "%s Auto.frz", Memory.ROMFilename);
|
||||||
|
else
|
||||||
|
sprintf(filepath, "%s/%s Auto.frz", GCSettings.SaveFolder, Memory.ROMFilename);
|
||||||
|
return NGCFreezeGame(filepath, method, silent);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* NGCUnFreezeBlock
|
* NGCUnFreezeBlock
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -235,22 +275,19 @@ NGCUnFreezeBlock (char *name, uint8 * block, int size)
|
|||||||
* NGCUnfreezeGame
|
* NGCUnfreezeGame
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int
|
int
|
||||||
NGCUnfreezeGame (int method, bool silent)
|
NGCUnfreezeGame (char * filepath, int method, bool silent)
|
||||||
{
|
{
|
||||||
char filepath[1024];
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
char msg[80];
|
char msg[80];
|
||||||
|
|
||||||
bufoffset = 0;
|
bufoffset = 0;
|
||||||
|
|
||||||
ShowAction ("Loading...");
|
|
||||||
|
|
||||||
if(method == METHOD_AUTO)
|
if(method == METHOD_AUTO)
|
||||||
method = autoSaveMethod(silent); // we use 'Save' because snapshot needs R/W
|
method = autoSaveMethod(silent); // we use 'Save' because snapshot needs R/W
|
||||||
|
|
||||||
if(!MakeFilePath(filepath, FILE_SNAPSHOT, method))
|
if(method == METHOD_AUTO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
AllocSaveBuffer ();
|
AllocSaveBuffer ();
|
||||||
|
|
||||||
@ -280,11 +317,11 @@ NGCUnfreezeGame (int method, bool silent)
|
|||||||
if ( err!=Z_OK )
|
if ( err!=Z_OK )
|
||||||
{
|
{
|
||||||
sprintf (msg, "Unzip error %s ",zError(err));
|
sprintf (msg, "Unzip error %s ",zError(err));
|
||||||
WaitPrompt (msg);
|
ErrorPrompt(msg);
|
||||||
}
|
}
|
||||||
else if ( DestBuffSize != decompressedsize )
|
else if ( DestBuffSize != decompressedsize )
|
||||||
{
|
{
|
||||||
WaitPrompt("Unzipped size doesn't match expected size!");
|
ErrorPrompt("Unzipped size doesn't match expected size!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -300,13 +337,26 @@ NGCUnfreezeGame (int method, bool silent)
|
|||||||
if (S9xUnfreezeGame ("AGAME") == SUCCESS)
|
if (S9xUnfreezeGame ("AGAME") == SUCCESS)
|
||||||
result = 1;
|
result = 1;
|
||||||
else
|
else
|
||||||
WaitPrompt("Error thawing");
|
ErrorPrompt("Error thawing");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!silent)
|
if(!silent)
|
||||||
WaitPrompt("Freeze file not found");
|
ErrorPrompt("Freeze file not found");
|
||||||
}
|
}
|
||||||
FreeSaveBuffer ();
|
FreeSaveBuffer ();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
NGCUnfreezeGameAuto (int method, bool silent)
|
||||||
|
{
|
||||||
|
char filepath[1024];
|
||||||
|
|
||||||
|
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
|
||||||
|
sprintf(filepath, "%s Auto.frz", Memory.ROMFilename);
|
||||||
|
else
|
||||||
|
sprintf(filepath, "%s/%s Auto.frz", GCSettings.SaveFolder, Memory.ROMFilename);
|
||||||
|
|
||||||
|
return NGCUnfreezeGame(filepath, method, silent);
|
||||||
|
}
|
||||||
|
@ -28,7 +28,9 @@ typedef struct
|
|||||||
}
|
}
|
||||||
MEMFILE;
|
MEMFILE;
|
||||||
|
|
||||||
int NGCFreezeGame (int method, bool silent);
|
int NGCFreezeGame (char * filepath, int method, bool silent);
|
||||||
int NGCUnfreezeGame (int method, bool silent);
|
int NGCFreezeGameAuto (int method, bool silent);
|
||||||
|
int NGCUnfreezeGame (char * filepath, int method, bool silent);
|
||||||
|
int NGCUnfreezeGameAuto (int method, bool silent);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,8 +26,9 @@ extern "C" {
|
|||||||
#include "dvd.h"
|
#include "dvd.h"
|
||||||
#include "networkop.h"
|
#include "networkop.h"
|
||||||
#include "fileop.h"
|
#include "fileop.h"
|
||||||
|
#include "filebrowser.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "menudraw.h"
|
#include "menu.h"
|
||||||
#include "gcunzip.h"
|
#include "gcunzip.h"
|
||||||
|
|
||||||
#define ZIPCHUNK 2048
|
#define ZIPCHUNK 2048
|
||||||
@ -148,7 +149,7 @@ UnZipBuffer (unsigned char *outbuffer, int method)
|
|||||||
res = inflateInit2 (&zs, -MAX_WBITS);
|
res = inflateInit2 (&zs, -MAX_WBITS);
|
||||||
|
|
||||||
if (res != Z_OK)
|
if (res != Z_OK)
|
||||||
return 0;
|
goto done;
|
||||||
|
|
||||||
/*** Set ZipChunk for first pass ***/
|
/*** Set ZipChunk for first pass ***/
|
||||||
zipoffset =
|
zipoffset =
|
||||||
@ -172,8 +173,7 @@ UnZipBuffer (unsigned char *outbuffer, int method)
|
|||||||
|
|
||||||
if (res == Z_MEM_ERROR)
|
if (res == Z_MEM_ERROR)
|
||||||
{
|
{
|
||||||
inflateEnd (&zs);
|
goto done;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
have = ZIPCHUNK - zs.avail_out;
|
have = ZIPCHUNK - zs.avail_out;
|
||||||
@ -201,23 +201,20 @@ UnZipBuffer (unsigned char *outbuffer, int method)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(sizeread <= 0)
|
if(sizeread <= 0)
|
||||||
break; // read failure
|
goto done; // read failure
|
||||||
|
|
||||||
ShowProgress ("Loading...", bufferoffset, pkzip.uncompressedSize);
|
ShowProgress ("Loading...", bufferoffset, pkzip.uncompressedSize);
|
||||||
}
|
}
|
||||||
while (res != Z_STREAM_END);
|
while (res != Z_STREAM_END);
|
||||||
|
|
||||||
|
done:
|
||||||
inflateEnd (&zs);
|
inflateEnd (&zs);
|
||||||
|
CancelAction();
|
||||||
|
|
||||||
if (res == Z_STREAM_END)
|
if (res == Z_STREAM_END)
|
||||||
{
|
return pkzip.uncompressedSize;
|
||||||
if (pkzip.uncompressedSize == (u32) bufferoffset)
|
else
|
||||||
return bufferoffset;
|
return 0;
|
||||||
else
|
|
||||||
return pkzip.uncompressedSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -250,7 +247,7 @@ GetFirstZipFilename (int method)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WaitPrompt("Error - Invalid ZIP file!");
|
ErrorPrompt("Error - Invalid ZIP file!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +317,7 @@ Is7ZipFile (char *buffer)
|
|||||||
// display an error message
|
// display an error message
|
||||||
static void SzDisplayError(SZ_RESULT res)
|
static void SzDisplayError(SZ_RESULT res)
|
||||||
{
|
{
|
||||||
WaitPrompt(szerrormsg[(res - 1)]);
|
ErrorPrompt(szerrormsg[(res - 1)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// function used by the 7zip SDK to read data from SD/USB/DVD/SMB
|
// function used by the 7zip SDK to read data from SD/USB/DVD/SMB
|
||||||
@ -475,7 +472,7 @@ int SzParse(char * filepath, int method)
|
|||||||
if(!newBrowserList) // failed to allocate required memory
|
if(!newBrowserList) // failed to allocate required memory
|
||||||
{
|
{
|
||||||
ResetBrowser();
|
ResetBrowser();
|
||||||
WaitPrompt("Out of memory: too many files!");
|
ErrorPrompt("Out of memory: too many files!");
|
||||||
nbfiles = 0;
|
nbfiles = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -556,6 +553,8 @@ int SzExtractFile(int i, unsigned char *buffer)
|
|||||||
// close 7Zip archive and free memory
|
// close 7Zip archive and free memory
|
||||||
SzClose();
|
SzClose();
|
||||||
|
|
||||||
|
CancelAction();
|
||||||
|
|
||||||
// check for errors
|
// check for errors
|
||||||
if(SzRes != SZ_OK)
|
if(SzRes != SZ_OK)
|
||||||
{
|
{
|
||||||
|
@ -1,568 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
|
||||||
*
|
|
||||||
* Michniewski 2008
|
|
||||||
*
|
|
||||||
* gui.cpp
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include <gccore.h>
|
|
||||||
#include <ogcsys.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <wiiuse/wpad.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
|
|
||||||
#include <pngu/pngu.h>
|
|
||||||
#include <ft2build.h>
|
|
||||||
#include <zlib.h>
|
|
||||||
#include FT_FREETYPE_H
|
|
||||||
|
|
||||||
#include "video.h"
|
|
||||||
#include "snes9xGX.h"
|
|
||||||
#include "gui.h"
|
|
||||||
|
|
||||||
struct sGui Gui;
|
|
||||||
|
|
||||||
GXTexObj texobj_BG, texobj_MENU;
|
|
||||||
void * texdata_bg; // stores the blended menu backdrop
|
|
||||||
void * texdata_menu; // stores the menu overlay
|
|
||||||
|
|
||||||
bool mem_alloced = 0;
|
|
||||||
|
|
||||||
extern GXTexObj texobj;
|
|
||||||
extern int vwidth, vheight;
|
|
||||||
extern s16 square[];
|
|
||||||
extern Mtx view;
|
|
||||||
extern int whichfb;
|
|
||||||
extern unsigned int copynow;
|
|
||||||
extern int screenheight;
|
|
||||||
extern unsigned int *xfb[2];
|
|
||||||
extern GXRModeObj *vmode;
|
|
||||||
|
|
||||||
extern FT_Library ftlibrary;
|
|
||||||
extern FT_Face face;
|
|
||||||
extern FT_GlyphSlot slot;
|
|
||||||
extern FT_UInt glyph_index;
|
|
||||||
|
|
||||||
extern int WaitButtonAB ();
|
|
||||||
|
|
||||||
|
|
||||||
// MAIN
|
|
||||||
|
|
||||||
static void
|
|
||||||
draw_vert (u8 pos, u8 c, f32 s, f32 t)
|
|
||||||
{
|
|
||||||
GX_Position1x8 (pos);
|
|
||||||
GX_Color1x8 (c);
|
|
||||||
GX_TexCoord2f32 (s, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
draw_square (Mtx v)
|
|
||||||
{
|
|
||||||
Mtx m; // model matrix.
|
|
||||||
Mtx mv; // modelview matrix.
|
|
||||||
|
|
||||||
guMtxIdentity (m);
|
|
||||||
guMtxTransApply (m, m, 0, 0, -100);
|
|
||||||
guMtxConcat (v, m, mv);
|
|
||||||
|
|
||||||
GX_LoadPosMtxImm (mv, GX_PNMTX0);
|
|
||||||
GX_Begin (GX_QUADS, GX_VTXFMT0, 4);
|
|
||||||
draw_vert (0, 0, 0.0, 0.0);
|
|
||||||
draw_vert (1, 0, 1.0, 0.0);
|
|
||||||
draw_vert (2, 0, 1.0, 1.0);
|
|
||||||
draw_vert (3, 0, 0.0, 1.0);
|
|
||||||
GX_End ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_alphasetup ()
|
|
||||||
{
|
|
||||||
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
|
||||||
GX_SetAlphaUpdate(GX_ENABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_alloc ()
|
|
||||||
{
|
|
||||||
if (!mem_alloced)
|
|
||||||
{
|
|
||||||
texdata_bg = memalign (32, 640 * 480 * 4);
|
|
||||||
texdata_menu = memalign (32, 640 * 480 * 4);
|
|
||||||
Gui.texmem = memalign (32, 640 * 480 * 4);
|
|
||||||
|
|
||||||
mem_alloced = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_free ()
|
|
||||||
{
|
|
||||||
if (mem_alloced)
|
|
||||||
{
|
|
||||||
free (texdata_bg);
|
|
||||||
free (texdata_menu);
|
|
||||||
free (Gui.texmem);
|
|
||||||
|
|
||||||
mem_alloced = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* make BG
|
|
||||||
*
|
|
||||||
* Blend the last rendered emulator screen and the menu backdrop.
|
|
||||||
* Save this as a texture to be loaded later
|
|
||||||
****************************************************************************/
|
|
||||||
void
|
|
||||||
gui_makebg ()
|
|
||||||
{
|
|
||||||
IMGCTX ctx;
|
|
||||||
PNGUPROP imgProp;
|
|
||||||
|
|
||||||
/** Load menu backdrop (either from file or buffer) **/
|
|
||||||
|
|
||||||
ctx = PNGU_SelectImageFromDevice ("bg.png");
|
|
||||||
PNGU_GetImageProperties (ctx, &imgProp);
|
|
||||||
// can check image dimensions here
|
|
||||||
//texdata_bg = memalign (32, imgProp.imgWidth * imgProp.imgHeight * 4);
|
|
||||||
GX_InitTexObj (&texobj_BG, &texdata_bg, 640, 480, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
|
||||||
//PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, &texdata_bg, 255);
|
|
||||||
PNGU_DecodeToRGBA8 (ctx, 640, 480, Gui.texmem, 0, 7);
|
|
||||||
Make_Texture_RGBA8 (&texdata_bg, Gui.texmem, 640, 480);
|
|
||||||
PNGU_ReleaseImageContext (ctx);
|
|
||||||
DCFlushRange (&texdata_bg, imgProp.imgWidth * imgProp.imgHeight * 4);
|
|
||||||
|
|
||||||
/*
|
|
||||||
texdata_bg = memalign (32, 640 * 480 * 4);
|
|
||||||
#ifdef HW_RVL
|
|
||||||
// on wii copy from memory
|
|
||||||
memcpy (texdata_bg, (char *) backdrop, 640 * 480 * 2);
|
|
||||||
#else
|
|
||||||
// on gc copy from aram
|
|
||||||
ARAMFetch (texdata_bg, (char *) AR_BACKDROP, 640 * 480 * 2);
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** blend last rendered snes frame and menu backdrop **/
|
|
||||||
|
|
||||||
// draw 640x480 quads
|
|
||||||
int xscale, yscale, xshift, yshift;
|
|
||||||
xshift = yshift = 0;
|
|
||||||
xscale = 320;
|
|
||||||
yscale = 240;
|
|
||||||
square[6] = square[3] = xscale + xshift;
|
|
||||||
square[0] = square[9] = -xscale + xshift;
|
|
||||||
square[4] = square[1] = yscale + yshift;
|
|
||||||
square[7] = square[10] = -yscale + yshift;
|
|
||||||
|
|
||||||
// draw 2 quads
|
|
||||||
|
|
||||||
GX_InvalidateTexAll ();
|
|
||||||
|
|
||||||
// behind (last snes frame)
|
|
||||||
square[2] = square[5] = square[8] = square[11] = 0; // z value
|
|
||||||
GX_InvVtxCache ();
|
|
||||||
GX_LoadTexObj (&texobj, GX_TEXMAP0); // load last rendered snes frame
|
|
||||||
draw_square (view);
|
|
||||||
|
|
||||||
// in front (menu backdrop)
|
|
||||||
square[2] = square[5] = square[8] = square[11] = 1; // z value
|
|
||||||
GX_InvVtxCache ();
|
|
||||||
GX_LoadTexObj (&texobj_BG, GX_TEXMAP0);
|
|
||||||
draw_square (view);
|
|
||||||
|
|
||||||
GX_DrawDone ();
|
|
||||||
|
|
||||||
/* DEBUG -----------
|
|
||||||
// show the output
|
|
||||||
VIDEO_SetNextFramebuffer (xfb[whichfb]);
|
|
||||||
VIDEO_Flush ();
|
|
||||||
copynow = GX_TRUE;
|
|
||||||
#ifdef VIDEO_THREADING
|
|
||||||
// Return to caller, don't waste time waiting for vb
|
|
||||||
LWP_ResumeThread (vbthread);
|
|
||||||
#endif
|
|
||||||
WaitButtonAB();
|
|
||||||
*/
|
|
||||||
|
|
||||||
// load blended image from efb to a texture
|
|
||||||
GX_InitTexObj (&texobj_BG, &texdata_bg, 640, 480, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
|
||||||
GX_SetTexCopySrc ( 0,0,640,480 );
|
|
||||||
GX_SetTexCopyDst ( 640, 480, GX_TF_RGBA8, 0 );
|
|
||||||
GX_CopyTex (&texdata_bg, 0); // assuming that the efb is 640x480, which it should be
|
|
||||||
GX_PixModeSync (); // wait until copy has completed
|
|
||||||
DCFlushRange (&texdata_bg, 640 * 480 * 4);
|
|
||||||
|
|
||||||
|
|
||||||
square[2] = square[5] = square[8] = square[11] = 0; // reset z value
|
|
||||||
GX_InvVtxCache ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_clearscreen ()
|
|
||||||
{
|
|
||||||
whichfb ^= 1;
|
|
||||||
VIDEO_ClearFrameBuffer (vmode, xfb[whichfb], COLOR_BLACK);
|
|
||||||
memset ( Gui.texmem, 0, sizeof(Gui.texmem) );
|
|
||||||
Gui.fontcolour = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_draw ()
|
|
||||||
{
|
|
||||||
gui_drawbox (0, 0, 640, 80, 255, 255, 255, 128); // topbar
|
|
||||||
gui_drawbox (0, 370, 640, 480, 255, 255, 255, 128); // bottombar
|
|
||||||
gui_setfontcolour (0,255,0,255);
|
|
||||||
// top bar text
|
|
||||||
setfontsize (32); // 32/24 depending on whether selected or not
|
|
||||||
gui_DrawText (-1, 35, "Menu");
|
|
||||||
// main text
|
|
||||||
setfontsize (24);
|
|
||||||
gui_DrawText (75, 113, "Hello World");
|
|
||||||
// bottom bar text
|
|
||||||
setfontsize (24);
|
|
||||||
gui_DrawText (75, 400, "Description");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_savescreen ()
|
|
||||||
{
|
|
||||||
FILE* handle;
|
|
||||||
handle = fopen ("out.txt", "wb");
|
|
||||||
fwrite (Gui.texmem, 1, sizeof(Gui.texmem), handle);
|
|
||||||
fclose (handle);
|
|
||||||
|
|
||||||
printf("\nsaved screen.");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_showscreen ()
|
|
||||||
{
|
|
||||||
|
|
||||||
/** Screen to Texture **/
|
|
||||||
|
|
||||||
GX_InitTexObj (&texobj_MENU, texdata_menu, 640, 480, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
|
||||||
Make_Texture_RGBA8 (texdata_menu, Gui.texmem, 640, 480);
|
|
||||||
DCFlushRange (&texdata_menu, 640 * 480 * 4);
|
|
||||||
|
|
||||||
GX_InvalidateTexAll ();
|
|
||||||
|
|
||||||
/** thats nice, but will it blend? **/
|
|
||||||
|
|
||||||
// draw 640x480 quads
|
|
||||||
int xscale, yscale, xshift, yshift;
|
|
||||||
xshift = yshift = 0;
|
|
||||||
xscale = 320;
|
|
||||||
yscale = 240;
|
|
||||||
square[6] = square[3] = xscale + xshift;
|
|
||||||
square[0] = square[9] = -xscale + xshift;
|
|
||||||
square[4] = square[1] = yscale + yshift;
|
|
||||||
square[7] = square[10] = -yscale + yshift;
|
|
||||||
|
|
||||||
// draw 2 quads
|
|
||||||
|
|
||||||
// backdrop
|
|
||||||
square[2] = square[5] = square[8] = square[11] = 0; // z value
|
|
||||||
GX_InvVtxCache ();
|
|
||||||
GX_LoadTexObj (&texobj_BG, GX_TEXMAP0);
|
|
||||||
draw_square (view);
|
|
||||||
|
|
||||||
// menu overlay
|
|
||||||
square[2] = square[5] = square[8] = square[11] = 1; // z value
|
|
||||||
GX_InvVtxCache ();
|
|
||||||
GX_LoadTexObj (&texobj_MENU, GX_TEXMAP0);
|
|
||||||
draw_square (view);
|
|
||||||
|
|
||||||
GX_DrawDone ();
|
|
||||||
|
|
||||||
/** Display **/
|
|
||||||
|
|
||||||
// show the output
|
|
||||||
VIDEO_SetNextFramebuffer (xfb[whichfb]);
|
|
||||||
VIDEO_Flush ();
|
|
||||||
copynow = GX_TRUE;
|
|
||||||
#ifdef VIDEO_THREADING
|
|
||||||
/* Return to caller, don't waste time waiting for vb */
|
|
||||||
LWP_ResumeThread (vbthread);
|
|
||||||
#endif
|
|
||||||
WaitButtonAB();
|
|
||||||
|
|
||||||
square[2] = square[5] = square[8] = square[11] = 0; // z value
|
|
||||||
GX_InvVtxCache ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Make Texture RGBA8
|
|
||||||
*
|
|
||||||
* input: pointer to RGBA data
|
|
||||||
* output: formatted texture data (GX_TF_RGBA8)
|
|
||||||
* code modified from quake wii (thanks :)
|
|
||||||
* todo: fix last few lines (?)
|
|
||||||
****************************************************************************/
|
|
||||||
void
|
|
||||||
Make_Texture_RGBA8 (void * dst_tex, void * src_data, int width, int height)
|
|
||||||
{
|
|
||||||
if ( (width % 4) || (height % 4) ) {
|
|
||||||
printf ("Error: make_texture_rgba8 width/height not multiple of 4");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int i, x, y;
|
|
||||||
u8 *pos;
|
|
||||||
|
|
||||||
pos = (u8 *)dst_tex;
|
|
||||||
for (y = 0; y < height; y += 4) // process 4 lines at a time to make rows of tiles
|
|
||||||
{
|
|
||||||
u8* row1 = (u8 *) src_data;
|
|
||||||
u8* row2 = (u8 *) src_data;
|
|
||||||
u8* row3 = (u8 *) src_data;
|
|
||||||
u8* row4 = (u8 *) src_data;
|
|
||||||
row1 += width * 4 * (y + 0); // move 640 pixels x 4 bytes * line #
|
|
||||||
row2 += width * 4 * (y + 1);
|
|
||||||
row3 += width * 4 * (y + 2);
|
|
||||||
row4 += width * 4 * (y + 3);
|
|
||||||
|
|
||||||
for (x = 0; x < width; x += 4) // move across 4 pixels per tile
|
|
||||||
{
|
|
||||||
u8 AR[32];
|
|
||||||
u8 GB[32];
|
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) // save those 4 pixels of data in texture format
|
|
||||||
{
|
|
||||||
u8* ptr1 = &(row1[(x + i) * 4]); // start at beginning of a row
|
|
||||||
u8* ptr2 = &(row2[(x + i) * 4]); // move across (4 pixels per tile + pixel offset within tile) * 4 bytes per pixel
|
|
||||||
u8* ptr3 = &(row3[(x + i) * 4]);
|
|
||||||
u8* ptr4 = &(row4[(x + i) * 4]);
|
|
||||||
|
|
||||||
AR[(i * 2) + 0] = ptr1[3]; // fill columns of tile with rgba data
|
|
||||||
AR[(i * 2) + 1] = ptr1[0];
|
|
||||||
AR[(i * 2) + 8] = ptr2[3];
|
|
||||||
AR[(i * 2) + 9] = ptr2[0];
|
|
||||||
AR[(i * 2) + 16] = ptr3[3];
|
|
||||||
AR[(i * 2) + 17] = ptr3[0];
|
|
||||||
AR[(i * 2) + 24] = ptr4[3];
|
|
||||||
AR[(i * 2) + 25] = ptr4[0];
|
|
||||||
|
|
||||||
GB[(i * 2) + 0] = ptr1[1];
|
|
||||||
GB[(i * 2) + 1] = ptr1[2];
|
|
||||||
GB[(i * 2) + 8] = ptr2[1];
|
|
||||||
GB[(i * 2) + 9] = ptr2[2];
|
|
||||||
GB[(i * 2) + 16] = ptr3[1];
|
|
||||||
GB[(i * 2) + 17] = ptr3[2];
|
|
||||||
GB[(i * 2) + 24] = ptr4[1];
|
|
||||||
GB[(i * 2) + 25] = ptr4[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(pos, AR, sizeof(AR)); // copy over to resulting texture
|
|
||||||
pos += sizeof(AR);
|
|
||||||
memcpy(pos, GB, sizeof(GB));
|
|
||||||
pos += sizeof(GB);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_drawbox (int x1, int y1, int width, int height, int r, int g, int b, int a)
|
|
||||||
{
|
|
||||||
u32 colour = ((u8)r << 24) | ((u8)g << 16) | ((u8)b << 8) | (u8)a;
|
|
||||||
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
u32* memory = (u32*) Gui.texmem;
|
|
||||||
for (j = y1; j<height; j++) {
|
|
||||||
for (i = x1; i<width; i++) {
|
|
||||||
memory[(j*640) + i] = colour;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* DrawCharacter
|
|
||||||
* Draws a single character on the screen
|
|
||||||
****************************************************************************/
|
|
||||||
/*static void
|
|
||||||
gui_DrawCharacter (FT_Bitmap * bmp, FT_Int x, FT_Int y)
|
|
||||||
{
|
|
||||||
FT_Int i, j, p, q;
|
|
||||||
FT_Int x_max = x + bmp->width;
|
|
||||||
FT_Int y_max = y + bmp->rows;
|
|
||||||
int c;
|
|
||||||
|
|
||||||
u32* memory = (u32*)Gui.texmem;
|
|
||||||
for (i = x, p = 0; i < x_max; i++, p++)
|
|
||||||
{
|
|
||||||
for (j = y, q = 0; j < y_max; j++, q++)
|
|
||||||
{
|
|
||||||
if (i < 0 || j < 0 || i >= 640 || j >= 480)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
c = bmp->buffer[q * bmp->width + p];
|
|
||||||
|
|
||||||
// Cool Anti-Aliasing doesn't work too well at hires on GC
|
|
||||||
if (c > 128)
|
|
||||||
memory[(j * 640) + i] = Gui.fontcolour;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* DrawText
|
|
||||||
*
|
|
||||||
* Place the font bitmap on the screen
|
|
||||||
****************************************************************************/
|
|
||||||
void
|
|
||||||
gui_DrawText (int x, int y, const char *text)
|
|
||||||
{
|
|
||||||
int px, n;
|
|
||||||
int i;
|
|
||||||
int err = 0;
|
|
||||||
int value, count;
|
|
||||||
|
|
||||||
n = strlen (text);
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*** x == -1, auto centre ***/
|
|
||||||
if (x == -1)
|
|
||||||
{
|
|
||||||
value = 0;
|
|
||||||
px = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value = 1;
|
|
||||||
px = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (count = value; count < 2; count++)
|
|
||||||
{
|
|
||||||
/*** Draw the string ***/
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
//err = FT_Load_Char (face, text[i], FT_LOAD_RENDER);
|
|
||||||
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
printf ("Error %c %d\n", text[i], err);
|
|
||||||
continue; /*** Skip unprintable characters ***/
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (count)
|
|
||||||
// gui_DrawCharacter (&slot->bitmap, px + slot->bitmap_left, y - slot->bitmap_top);
|
|
||||||
|
|
||||||
// px += slot->advance.x >> 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
px = (640 - px) >> 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* setfontcolour
|
|
||||||
*
|
|
||||||
* Uses RGB triple values.
|
|
||||||
****************************************************************************/
|
|
||||||
void
|
|
||||||
gui_setfontcolour (int r, int g, int b, int a)
|
|
||||||
{
|
|
||||||
Gui.fontcolour = ((u8)r << 24) | ((u8)g << 16) | ((u8)b << 8) | (u8)a;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* DrawLine
|
|
||||||
*
|
|
||||||
* Quick'n'Dirty Bresenham line drawing routine.
|
|
||||||
****************************************************************************/
|
|
||||||
#define SIGN(x) ((x<0)?-1:((x>0)?1:0))
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_DrawLine (int x1, int y1, int x2, int y2, int r, int g, int b, int a)
|
|
||||||
{
|
|
||||||
u32 colour;
|
|
||||||
int i, dx, dy, sdx, sdy, dxabs, dyabs, x, y, px, py;
|
|
||||||
int sp;
|
|
||||||
|
|
||||||
u32* memory = (u32*)Gui.texmem;
|
|
||||||
|
|
||||||
colour = ((u8)r << 24) | ((u8)g << 16) | ((u8)b << 8) | (u8)a;
|
|
||||||
|
|
||||||
dx = x2 - x1; /*** Horizontal distance ***/
|
|
||||||
dy = y2 - y1; /*** Vertical distance ***/
|
|
||||||
|
|
||||||
dxabs = abs (dx);
|
|
||||||
dyabs = abs (dy);
|
|
||||||
sdx = SIGN (dx);
|
|
||||||
sdy = SIGN (dy);
|
|
||||||
x = dyabs >> 1;
|
|
||||||
y = dxabs >> 1;
|
|
||||||
px = x1;
|
|
||||||
py = y1;
|
|
||||||
|
|
||||||
sp = (py * 640) + px;
|
|
||||||
|
|
||||||
/*** Plot this pixel ***/
|
|
||||||
memory[sp] = colour;
|
|
||||||
|
|
||||||
if (dxabs >= dyabs) /*** Mostly horizontal ***/
|
|
||||||
{
|
|
||||||
for (i = 0; i < dxabs; i++)
|
|
||||||
{
|
|
||||||
y += dyabs;
|
|
||||||
if (y >= dxabs)
|
|
||||||
{
|
|
||||||
y -= dxabs;
|
|
||||||
py += sdy;
|
|
||||||
}
|
|
||||||
|
|
||||||
px += sdx;
|
|
||||||
sp = (py * 640) + px;
|
|
||||||
memory[sp] = colour;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (i = 0; i < dyabs; i++)
|
|
||||||
{
|
|
||||||
x += dxabs;
|
|
||||||
if (x >= dyabs)
|
|
||||||
{
|
|
||||||
x -= dyabs;
|
|
||||||
px += sdx;
|
|
||||||
}
|
|
||||||
|
|
||||||
py += sdy;
|
|
||||||
sp = (py * 640) + px;
|
|
||||||
memory[sp] = colour;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* */
|
|
||||||
|
|
||||||
/** draw menu, etc **/
|
|
||||||
// - draw topbar, bottombar
|
|
||||||
// - draw icons
|
|
||||||
// - draw bar text
|
|
||||||
|
|
||||||
// draw main text
|
|
||||||
|
|
||||||
/** make textures **/
|
|
||||||
// - load background texture
|
|
||||||
// - draw onto quad
|
|
||||||
// - make foreground texture
|
|
||||||
// - draw onto quad
|
|
||||||
|
|
||||||
/** render image **/
|
|
||||||
|
|
||||||
/** update framebuffer **/
|
|
||||||
|
|
||||||
/* */
|
|
||||||
|
|
||||||
// EOF
|
|
@ -1,43 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
|
||||||
*
|
|
||||||
* Michniewski 2008
|
|
||||||
*
|
|
||||||
* gui.h
|
|
||||||
***************************************************************************/
|
|
||||||
#ifndef __GUI_H__
|
|
||||||
#define __GUI_H__
|
|
||||||
|
|
||||||
#include <gccore.h>
|
|
||||||
|
|
||||||
|
|
||||||
struct sGui {
|
|
||||||
void * texmem; // rgba8 - working draw area
|
|
||||||
int currmenu;
|
|
||||||
int prevmenu;
|
|
||||||
u32 fontcolour;
|
|
||||||
int screenheight;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct sGui Gui;
|
|
||||||
|
|
||||||
// Prototypes
|
|
||||||
void gui_alphasetup ();
|
|
||||||
void gui_makebg ();
|
|
||||||
void Make_Texture_RGBA8 (void * dst_tex, void * src_data, int width, int height);
|
|
||||||
void gui_drawbox (int x1, int y1, int width, int height, int r, int g, int b, int a);
|
|
||||||
void gui_DrawText (int x, int y, const char *text);
|
|
||||||
void gui_setfontcolour (int r, int g, int b, int a);
|
|
||||||
void gui_DrawLine (int x1, int y1, int x2, int y2, int r, int g, int b, int a);
|
|
||||||
void gui_clearscreen ();
|
|
||||||
void gui_draw ();
|
|
||||||
void gui_showscreen ();
|
|
||||||
|
|
||||||
void gui_savescreen ();
|
|
||||||
|
|
||||||
// external functions
|
|
||||||
extern void setfontsize (int pixelsize);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
549
source/ngc/gui/gui.h
Normal file
@ -0,0 +1,549 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui.h
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef GUI_H
|
||||||
|
#define GUI_H
|
||||||
|
|
||||||
|
#include <gccore.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <math.h>
|
||||||
|
#include <wiiuse/wpad.h>
|
||||||
|
#include <asndlib.h>
|
||||||
|
#include "pngu/pngu.h"
|
||||||
|
#include "FreeTypeGX.h"
|
||||||
|
#include "snes9xGX.h"
|
||||||
|
#include "video.h"
|
||||||
|
#include "input.h"
|
||||||
|
#include "filelist.h"
|
||||||
|
#include "fileop.h"
|
||||||
|
#include "menu.h"
|
||||||
|
#include "oggplayer.h"
|
||||||
|
|
||||||
|
#define PI 3.14159265f
|
||||||
|
#define PADCAL 50
|
||||||
|
#define SCROLL_INITIAL_DELAY 20
|
||||||
|
#define SCROLL_LOOP_DELAY 3
|
||||||
|
#define PAGESIZE 8
|
||||||
|
#define SAVELISTSIZE 6
|
||||||
|
|
||||||
|
typedef void (*UpdateCallback)(void * e);
|
||||||
|
|
||||||
|
typedef struct _paddata {
|
||||||
|
u16 btns_d;
|
||||||
|
u16 btns_u;
|
||||||
|
u16 btns_h;
|
||||||
|
s8 stickX;
|
||||||
|
s8 stickY;
|
||||||
|
s8 substickX;
|
||||||
|
s8 substickY;
|
||||||
|
u8 triggerL;
|
||||||
|
u8 triggerR;
|
||||||
|
} PADData;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
ALIGN_LEFT,
|
||||||
|
ALIGN_RIGHT,
|
||||||
|
ALIGN_CENTRE,
|
||||||
|
ALIGN_TOP,
|
||||||
|
ALIGN_BOTTOM,
|
||||||
|
ALIGN_MIDDLE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
STATE_DEFAULT,
|
||||||
|
STATE_SELECTED,
|
||||||
|
STATE_CLICKED,
|
||||||
|
STATE_DISABLED
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TRIGGER_SIMPLE,
|
||||||
|
TRIGGER_BUTTON_ONLY,
|
||||||
|
TRIGGER_BUTTON_ONLY_IN_FOCUS
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SOUND_PCM,
|
||||||
|
SOUND_OGG
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
IMAGE_TEXTURE,
|
||||||
|
IMAGE_COLOR,
|
||||||
|
IMAGE_DATA
|
||||||
|
};
|
||||||
|
|
||||||
|
#define EFFECT_SLIDE_TOP 1
|
||||||
|
#define EFFECT_SLIDE_BOTTOM 2
|
||||||
|
#define EFFECT_SLIDE_RIGHT 4
|
||||||
|
#define EFFECT_SLIDE_LEFT 8
|
||||||
|
#define EFFECT_SLIDE_IN 16
|
||||||
|
#define EFFECT_SLIDE_OUT 32
|
||||||
|
#define EFFECT_FADE 64
|
||||||
|
#define EFFECT_SCALE 128
|
||||||
|
#define EFFECT_COLOR_TRANSITION 256
|
||||||
|
|
||||||
|
class GuiSound
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiSound(const u8 * s, int l, int t);
|
||||||
|
~GuiSound();
|
||||||
|
void Play();
|
||||||
|
void Stop();
|
||||||
|
void Pause();
|
||||||
|
void Resume();
|
||||||
|
void SetVolume(int v);
|
||||||
|
protected:
|
||||||
|
const u8 * sound;
|
||||||
|
int type;
|
||||||
|
s32 length;
|
||||||
|
s32 voice;
|
||||||
|
s32 volume;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GuiTrigger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiTrigger();
|
||||||
|
~GuiTrigger();
|
||||||
|
void SetSimpleTrigger(s32 ch, u32 wiibtns, u16 gcbtns);
|
||||||
|
void SetButtonOnlyTrigger(s32 ch, u32 wiibtns, u16 gcbtns);
|
||||||
|
void SetButtonOnlyInFocusTrigger(s32 ch, u32 wiibtns, u16 gcbtns);
|
||||||
|
s8 WPAD_Stick(u8 right, int axis);
|
||||||
|
bool Left();
|
||||||
|
bool Right();
|
||||||
|
bool Up();
|
||||||
|
bool Down();
|
||||||
|
|
||||||
|
u8 type;
|
||||||
|
s32 chan;
|
||||||
|
WPADData wpad;
|
||||||
|
PADData pad;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GuiElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiElement();
|
||||||
|
~GuiElement();
|
||||||
|
void SetParent(GuiElement * e);
|
||||||
|
int GetLeft();
|
||||||
|
int GetTop();
|
||||||
|
int GetWidth();
|
||||||
|
int GetHeight();
|
||||||
|
void SetSize(int w, int h);
|
||||||
|
bool IsVisible();
|
||||||
|
bool IsSelectable();
|
||||||
|
bool IsClickable();
|
||||||
|
void SetSelectable(bool s);
|
||||||
|
void SetClickable(bool c);
|
||||||
|
int GetState();
|
||||||
|
void SetVisible(bool v);
|
||||||
|
void SetAlpha(int a);
|
||||||
|
int GetAlpha();
|
||||||
|
void SetScale(float s);
|
||||||
|
float GetScale();
|
||||||
|
void SetTrigger(GuiTrigger * t);
|
||||||
|
void SetTrigger(u8 i, GuiTrigger * t);
|
||||||
|
void SetEffect(int e, int a, int t=0);
|
||||||
|
void SetEffectOnOver(int e, int a, int t=0);
|
||||||
|
void SetEffectGrow();
|
||||||
|
int GetEffect();
|
||||||
|
bool IsInside(int x, int y);
|
||||||
|
void SetPosition(int x, int y);
|
||||||
|
void UpdateEffects();
|
||||||
|
void SetUpdateCallback(UpdateCallback u);
|
||||||
|
int IsFocused();
|
||||||
|
virtual void SetFocus(int f);
|
||||||
|
virtual void SetState(int s);
|
||||||
|
virtual void ResetState();
|
||||||
|
virtual int GetSelected();
|
||||||
|
virtual void SetAlignment(int hor, int vert);
|
||||||
|
virtual void Update(GuiTrigger * t);
|
||||||
|
virtual void Draw();
|
||||||
|
protected:
|
||||||
|
bool visible;
|
||||||
|
int focus; // -1 = cannot focus, 0 = not focused, 1 = focused
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int xoffset;
|
||||||
|
int yoffset;
|
||||||
|
int xoffsetDyn;
|
||||||
|
int yoffsetDyn;
|
||||||
|
int alpha;
|
||||||
|
f32 scale;
|
||||||
|
int alphaDyn;
|
||||||
|
f32 scaleDyn;
|
||||||
|
int effects;
|
||||||
|
int effectAmount;
|
||||||
|
int effectTarget;
|
||||||
|
int effectsOver;
|
||||||
|
int effectAmountOver;
|
||||||
|
int effectTargetOver;
|
||||||
|
int alignmentHor; // LEFT, RIGHT, CENTRE
|
||||||
|
int alignmentVert; // TOP, BOTTOM, MIDDLE
|
||||||
|
int state; // DEFAULT, SELECTED, CLICKED, DISABLED
|
||||||
|
bool selectable; // is SELECTED a valid state?
|
||||||
|
bool clickable; // is CLICKED a valid state?
|
||||||
|
GuiTrigger * trigger[2];
|
||||||
|
GuiElement * parentElement;
|
||||||
|
UpdateCallback updateCB;
|
||||||
|
};
|
||||||
|
|
||||||
|
//!Groups elements into one window in which they can be managed.
|
||||||
|
class GuiWindow : public GuiElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//!Constructor
|
||||||
|
GuiWindow();
|
||||||
|
GuiWindow(int w, int h);
|
||||||
|
//!Destructor.
|
||||||
|
~GuiWindow();
|
||||||
|
|
||||||
|
//!Appends a element at the end, thus drawing it at last.
|
||||||
|
//!\param element The element to append. If it is already in the list, it gets removed first.
|
||||||
|
void Append(GuiElement* e);
|
||||||
|
//!Inserts a element into the manager.
|
||||||
|
//!\param element The element to insert. If it is already in the list, it gets removed first.
|
||||||
|
//!\param index The new index of the element.
|
||||||
|
void Insert(GuiElement* e, u32 index);
|
||||||
|
//!Removes a element from the list.
|
||||||
|
//!\param element A element that is in the list.
|
||||||
|
void Remove(GuiElement* e);
|
||||||
|
//!Clears the whole GuiWindow from all GuiElement.
|
||||||
|
void RemoveAll();
|
||||||
|
|
||||||
|
//!Returns a element at a specified index.
|
||||||
|
//!\param index The index from where to poll the element.
|
||||||
|
//!\return A pointer to the element at the index. NULL if index is out of bounds.
|
||||||
|
GuiElement* GetGuiElementAt(u32 index) const;
|
||||||
|
//!Returns the size of the list of elements.
|
||||||
|
//!\return The size of the current elementlist.
|
||||||
|
u32 GetSize();
|
||||||
|
void ResetState();
|
||||||
|
void SetState(int s);
|
||||||
|
int GetSelected();
|
||||||
|
void SetFocus(int f);
|
||||||
|
void ChangeFocus(GuiElement * e);
|
||||||
|
void ToggleFocus(GuiTrigger * t);
|
||||||
|
void MoveSelectionHor(int d);
|
||||||
|
void MoveSelectionVert(int d);
|
||||||
|
|
||||||
|
//!Draws all the elements in this GuiWindow.
|
||||||
|
void Draw();
|
||||||
|
void Update(GuiTrigger * t);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<GuiElement*> _elements;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GuiImageData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiImageData(const u8 * i);
|
||||||
|
~GuiImageData();
|
||||||
|
u8 * GetImage();
|
||||||
|
int GetWidth();
|
||||||
|
int GetHeight();
|
||||||
|
protected:
|
||||||
|
u8 * data;
|
||||||
|
int height;
|
||||||
|
int width;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GuiImage : public GuiElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiImage(GuiImageData * img);
|
||||||
|
GuiImage(u8 * img, int w, int h);
|
||||||
|
GuiImage(int w, int h, GXColor c);
|
||||||
|
~GuiImage();
|
||||||
|
void SetAngle(float a);
|
||||||
|
void SetTile(int t);
|
||||||
|
void Draw();
|
||||||
|
u8 * GetImage();
|
||||||
|
void SetImage(GuiImageData * img);
|
||||||
|
void SetImage(u8 * img, int w, int h);
|
||||||
|
GXColor GetPixel(int x, int y);
|
||||||
|
void SetPixel(int x, int y, GXColor color);
|
||||||
|
void ColorStripe(int s);
|
||||||
|
void SetStripe(int s);
|
||||||
|
protected:
|
||||||
|
int imgType;
|
||||||
|
u8 * image;
|
||||||
|
f32 imageangle;
|
||||||
|
int tile;
|
||||||
|
int stripe;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GuiText : public GuiElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiText(const char * t, int s, GXColor c);
|
||||||
|
~GuiText();
|
||||||
|
void SetText(const char * t);
|
||||||
|
void SetSize(int s);
|
||||||
|
void SetColor(GXColor c);
|
||||||
|
void SetStyle(u16 s);
|
||||||
|
void SetAlignment(int hor, int vert);
|
||||||
|
void Draw();
|
||||||
|
protected:
|
||||||
|
wchar_t* text;
|
||||||
|
int size;
|
||||||
|
u16 style;
|
||||||
|
GXColor color;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GuiButton : public GuiElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiButton(int w, int h);
|
||||||
|
~GuiButton();
|
||||||
|
void SetImage(GuiImage* i);
|
||||||
|
void SetImageOver(GuiImage* i);
|
||||||
|
void SetIcon(GuiImage* i);
|
||||||
|
void SetIconOver(GuiImage* i);
|
||||||
|
void SetLabel(GuiText* t);
|
||||||
|
void SetLabelOver(GuiText* t);
|
||||||
|
void SetLabel(GuiText* t, int n);
|
||||||
|
void SetLabelOver(GuiText* t, int n);
|
||||||
|
void SetSoundOver(GuiSound * s);
|
||||||
|
void SetSoundClick(GuiSound * s);
|
||||||
|
void Draw();
|
||||||
|
void Update(GuiTrigger * t);
|
||||||
|
protected:
|
||||||
|
GuiImage * image;
|
||||||
|
GuiImage * imageOver;
|
||||||
|
GuiImage * icon;
|
||||||
|
GuiImage * iconOver;
|
||||||
|
GuiText * label[3];
|
||||||
|
GuiText * labelOver[3];
|
||||||
|
GuiSound * soundOver;
|
||||||
|
GuiSound * soundClick;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GuiFileBrowser : public GuiElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiFileBrowser(int w, int h);
|
||||||
|
~GuiFileBrowser();
|
||||||
|
void ResetState();
|
||||||
|
void SetFocus(int f);
|
||||||
|
void Draw();
|
||||||
|
void TriggerUpdate();
|
||||||
|
void Update(GuiTrigger * t);
|
||||||
|
GuiButton * gameList[PAGESIZE];
|
||||||
|
protected:
|
||||||
|
int selectedItem;
|
||||||
|
bool listChanged;
|
||||||
|
|
||||||
|
GuiText * gameListText[PAGESIZE];
|
||||||
|
GuiImage * gameListBg[PAGESIZE];
|
||||||
|
GuiImage * gameListFolder[PAGESIZE];
|
||||||
|
|
||||||
|
GuiButton * arrowUpBtn;
|
||||||
|
GuiButton * arrowDownBtn;
|
||||||
|
GuiButton * scrollbarBoxBtn;
|
||||||
|
|
||||||
|
GuiImage * bgGameSelectionImg;
|
||||||
|
GuiImage * scrollbarImg;
|
||||||
|
GuiImage * arrowDownImg;
|
||||||
|
GuiImage * arrowDownOverImg;
|
||||||
|
GuiImage * arrowUpImg;
|
||||||
|
GuiImage * arrowUpOverImg;
|
||||||
|
GuiImage * scrollbarBoxImg;
|
||||||
|
GuiImage * scrollbarBoxOverImg;
|
||||||
|
|
||||||
|
GuiImageData * bgGameSelection;
|
||||||
|
GuiImageData * bgGameSelectionEntry;
|
||||||
|
GuiImageData * gameFolder;
|
||||||
|
GuiImageData * scrollbar;
|
||||||
|
GuiImageData * arrowDown;
|
||||||
|
GuiImageData * arrowDownOver;
|
||||||
|
GuiImageData * arrowUp;
|
||||||
|
GuiImageData * arrowUpOver;
|
||||||
|
GuiImageData * scrollbarBox;
|
||||||
|
GuiImageData * scrollbarBoxOver;
|
||||||
|
|
||||||
|
GuiTrigger * trigA;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _optionlist {
|
||||||
|
int length;
|
||||||
|
char name[150][50];
|
||||||
|
char value[150][50];
|
||||||
|
} OptionList;
|
||||||
|
|
||||||
|
class GuiOptionBrowser : public GuiElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiOptionBrowser(int w, int h, OptionList * l);
|
||||||
|
~GuiOptionBrowser();
|
||||||
|
void SetCol2Position(int x);
|
||||||
|
int FindMenuItem(int c, int d);
|
||||||
|
int GetClickedOption();
|
||||||
|
void ResetState();
|
||||||
|
void SetFocus(int f);
|
||||||
|
void Draw();
|
||||||
|
void Update(GuiTrigger * t);
|
||||||
|
GuiText * optionVal[PAGESIZE];
|
||||||
|
protected:
|
||||||
|
int selectedItem;
|
||||||
|
int listOffset;
|
||||||
|
|
||||||
|
OptionList * options;
|
||||||
|
int optionIndex[PAGESIZE];
|
||||||
|
GuiButton * optionBtn[PAGESIZE];
|
||||||
|
GuiText * optionTxt[PAGESIZE];
|
||||||
|
GuiImage * optionBg[PAGESIZE];
|
||||||
|
|
||||||
|
GuiButton * arrowUpBtn;
|
||||||
|
GuiButton * arrowDownBtn;
|
||||||
|
GuiButton * scrollbarBoxBtn;
|
||||||
|
|
||||||
|
GuiImage * bgOptionsImg;
|
||||||
|
GuiImage * scrollbarImg;
|
||||||
|
GuiImage * arrowDownImg;
|
||||||
|
GuiImage * arrowDownOverImg;
|
||||||
|
GuiImage * arrowUpImg;
|
||||||
|
GuiImage * arrowUpOverImg;
|
||||||
|
GuiImage * scrollbarBoxImg;
|
||||||
|
GuiImage * scrollbarBoxOverImg;
|
||||||
|
|
||||||
|
GuiImageData * bgOptions;
|
||||||
|
GuiImageData * bgOptionsEntry;
|
||||||
|
GuiImageData * scrollbar;
|
||||||
|
GuiImageData * arrowDown;
|
||||||
|
GuiImageData * arrowDownOver;
|
||||||
|
GuiImageData * arrowUp;
|
||||||
|
GuiImageData * arrowUpOver;
|
||||||
|
GuiImageData * scrollbarBox;
|
||||||
|
GuiImageData * scrollbarBoxOver;
|
||||||
|
|
||||||
|
GuiTrigger * trigA;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _savelist {
|
||||||
|
int length;
|
||||||
|
char filename[20][255];
|
||||||
|
GuiImageData * previewImg[20];
|
||||||
|
char date[20][50];
|
||||||
|
char time[10][50];
|
||||||
|
int type[20];
|
||||||
|
int files[2][100];
|
||||||
|
} SaveList;
|
||||||
|
|
||||||
|
class GuiSaveBrowser : public GuiElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiSaveBrowser(int w, int h, SaveList * l, int a);
|
||||||
|
~GuiSaveBrowser();
|
||||||
|
int GetClickedSave();
|
||||||
|
void ResetState();
|
||||||
|
void SetFocus(int f);
|
||||||
|
void Draw();
|
||||||
|
void Update(GuiTrigger * t);
|
||||||
|
protected:
|
||||||
|
int selectedItem;
|
||||||
|
int listOffset;
|
||||||
|
int action;
|
||||||
|
|
||||||
|
SaveList * saves;
|
||||||
|
GuiButton * saveBtn[SAVELISTSIZE];
|
||||||
|
GuiText * saveDate[SAVELISTSIZE];
|
||||||
|
GuiText * saveTime[SAVELISTSIZE];
|
||||||
|
GuiText * saveType[SAVELISTSIZE];
|
||||||
|
|
||||||
|
GuiImage * saveBgImg[SAVELISTSIZE];
|
||||||
|
GuiImage * saveBgOverImg[SAVELISTSIZE];
|
||||||
|
GuiImage * savePreviewImg[SAVELISTSIZE];
|
||||||
|
|
||||||
|
GuiButton * arrowUpBtn;
|
||||||
|
GuiButton * arrowDownBtn;
|
||||||
|
GuiButton * scrollbarBoxBtn;
|
||||||
|
|
||||||
|
GuiImage * scrollbarImg;
|
||||||
|
GuiImage * arrowDownImg;
|
||||||
|
GuiImage * arrowDownOverImg;
|
||||||
|
GuiImage * arrowUpImg;
|
||||||
|
GuiImage * arrowUpOverImg;
|
||||||
|
GuiImage * scrollbarBoxImg;
|
||||||
|
GuiImage * scrollbarBoxOverImg;
|
||||||
|
|
||||||
|
GuiImageData * gameSave;
|
||||||
|
GuiImageData * gameSaveOver;
|
||||||
|
GuiImageData * gameSaveBlank;
|
||||||
|
GuiImageData * scrollbar;
|
||||||
|
GuiImageData * arrowDown;
|
||||||
|
GuiImageData * arrowDownOver;
|
||||||
|
GuiImageData * arrowUp;
|
||||||
|
GuiImageData * arrowUpOver;
|
||||||
|
GuiImageData * scrollbarBox;
|
||||||
|
GuiImageData * scrollbarBoxOver;
|
||||||
|
|
||||||
|
GuiTrigger * trigA;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _keytype {
|
||||||
|
char ch, chShift;
|
||||||
|
} Key;
|
||||||
|
|
||||||
|
class GuiKeyboard : public GuiWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiKeyboard(char * t);
|
||||||
|
~GuiKeyboard();
|
||||||
|
void Update(GuiTrigger * t);
|
||||||
|
char kbtextstr[100];
|
||||||
|
protected:
|
||||||
|
Key keys[4][10];
|
||||||
|
int shift;
|
||||||
|
int caps;
|
||||||
|
GuiText * kbText;
|
||||||
|
GuiImage * keyTextboxImg;
|
||||||
|
GuiText * keyCapsText;
|
||||||
|
GuiImage * keyCapsImg;
|
||||||
|
GuiImage * keyCapsOverImg;
|
||||||
|
GuiButton * keyCaps;
|
||||||
|
GuiText * keyShiftText;
|
||||||
|
GuiImage * keyShiftImg;
|
||||||
|
GuiImage * keyShiftOverImg;
|
||||||
|
GuiButton * keyShift;
|
||||||
|
GuiText * keyBackText;
|
||||||
|
GuiImage * keyBackImg;
|
||||||
|
GuiImage * keyBackOverImg;
|
||||||
|
GuiButton * keyBack;
|
||||||
|
GuiImage * keySpaceImg;
|
||||||
|
GuiImage * keySpaceOverImg;
|
||||||
|
GuiButton * keySpace;
|
||||||
|
GuiButton * keyBtn[4][10];
|
||||||
|
GuiImage * keyImg[4][10];
|
||||||
|
GuiImage * keyImgOver[4][10];
|
||||||
|
GuiText * keyTxt[4][10];
|
||||||
|
GuiImageData * keyTextbox;
|
||||||
|
GuiImageData * key;
|
||||||
|
GuiImageData * keyOver;
|
||||||
|
GuiImageData * keyMedium;
|
||||||
|
GuiImageData * keyMediumOver;
|
||||||
|
GuiImageData * keyLarge;
|
||||||
|
GuiImageData * keyLargeOver;
|
||||||
|
GuiSound * keySoundOver;
|
||||||
|
GuiTrigger * trigA;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
228
source/ngc/gui/gui_button.cpp
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_button.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
/**
|
||||||
|
* Constructor for the GuiButton class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
GuiButton::GuiButton(int w, int h)
|
||||||
|
{
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
image = NULL;
|
||||||
|
imageOver = NULL;
|
||||||
|
icon = NULL;
|
||||||
|
iconOver = NULL;
|
||||||
|
|
||||||
|
for(int i=0; i < 3; i++)
|
||||||
|
{
|
||||||
|
label[i] = NULL;
|
||||||
|
labelOver[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
soundOver = NULL;
|
||||||
|
soundClick = NULL;
|
||||||
|
selectable = true;
|
||||||
|
clickable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiButton class.
|
||||||
|
*/
|
||||||
|
GuiButton::~GuiButton()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiButton::SetImage(GuiImage* img)
|
||||||
|
{
|
||||||
|
image = img;
|
||||||
|
|
||||||
|
if(img)
|
||||||
|
img->SetParent(this);
|
||||||
|
}
|
||||||
|
void GuiButton::SetImageOver(GuiImage* img)
|
||||||
|
{
|
||||||
|
imageOver = img;
|
||||||
|
|
||||||
|
if(img)
|
||||||
|
img->SetParent(this);
|
||||||
|
}
|
||||||
|
void GuiButton::SetIcon(GuiImage* img)
|
||||||
|
{
|
||||||
|
icon = img;
|
||||||
|
|
||||||
|
if(img)
|
||||||
|
img->SetParent(this);
|
||||||
|
}
|
||||||
|
void GuiButton::SetIconOver(GuiImage* img)
|
||||||
|
{
|
||||||
|
iconOver = img;
|
||||||
|
|
||||||
|
if(img)
|
||||||
|
img->SetParent(this);
|
||||||
|
}
|
||||||
|
void GuiButton::SetLabel(GuiText* txt)
|
||||||
|
{
|
||||||
|
label[0] = txt;
|
||||||
|
|
||||||
|
if(txt)
|
||||||
|
txt->SetParent(this);
|
||||||
|
}
|
||||||
|
void GuiButton::SetLabelOver(GuiText* txt)
|
||||||
|
{
|
||||||
|
labelOver[0] = txt;
|
||||||
|
|
||||||
|
if(txt)
|
||||||
|
txt->SetParent(this);
|
||||||
|
}
|
||||||
|
void GuiButton::SetLabel(GuiText* txt, int n)
|
||||||
|
{
|
||||||
|
label[n] = txt;
|
||||||
|
|
||||||
|
if(txt)
|
||||||
|
txt->SetParent(this);
|
||||||
|
}
|
||||||
|
void GuiButton::SetLabelOver(GuiText* txt, int n)
|
||||||
|
{
|
||||||
|
labelOver[n] = txt;
|
||||||
|
|
||||||
|
if(txt)
|
||||||
|
txt->SetParent(this);
|
||||||
|
}
|
||||||
|
void GuiButton::SetSoundOver(GuiSound * snd)
|
||||||
|
{
|
||||||
|
soundOver = snd;
|
||||||
|
}
|
||||||
|
void GuiButton::SetSoundClick(GuiSound * snd)
|
||||||
|
{
|
||||||
|
soundClick = snd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the button on screen
|
||||||
|
*/
|
||||||
|
void GuiButton::Draw()
|
||||||
|
{
|
||||||
|
if(!this->IsVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// draw image
|
||||||
|
if(state == STATE_SELECTED && imageOver)
|
||||||
|
imageOver->Draw();
|
||||||
|
else if(image)
|
||||||
|
image->Draw();
|
||||||
|
// draw icon
|
||||||
|
if(state == STATE_SELECTED && iconOver)
|
||||||
|
iconOver->Draw();
|
||||||
|
else if(icon)
|
||||||
|
icon->Draw();
|
||||||
|
// draw text
|
||||||
|
for(int i=0; i<3; i++)
|
||||||
|
{
|
||||||
|
if(state == STATE_SELECTED && labelOver[i])
|
||||||
|
labelOver[i]->Draw();
|
||||||
|
else if(label[i])
|
||||||
|
label[i]->Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->UpdateEffects();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiButton::Update(GuiTrigger * t)
|
||||||
|
{
|
||||||
|
if(state == STATE_CLICKED || state == STATE_DISABLED || !t)
|
||||||
|
return;
|
||||||
|
else if(parentElement && parentElement->GetState() == STATE_DISABLED)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
// cursor
|
||||||
|
if(t->wpad.ir.valid && this->IsSelectable())
|
||||||
|
{
|
||||||
|
if(this->IsInside(t->wpad.ir.x, t->wpad.ir.y))
|
||||||
|
{
|
||||||
|
if(state == STATE_DEFAULT) // we weren't on the button before!
|
||||||
|
{
|
||||||
|
state = STATE_SELECTED;
|
||||||
|
rumbleRequest[t->chan] = 1;
|
||||||
|
|
||||||
|
if(soundOver)
|
||||||
|
soundOver->Play();
|
||||||
|
|
||||||
|
if(effectsOver && !effects)
|
||||||
|
{
|
||||||
|
// initiate effects
|
||||||
|
effects = effectsOver;
|
||||||
|
effectAmount = effectAmountOver;
|
||||||
|
effectTarget = effectTargetOver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(state == STATE_SELECTED)
|
||||||
|
{
|
||||||
|
state = STATE_DEFAULT;
|
||||||
|
|
||||||
|
if(effectsOver && !effects)
|
||||||
|
{
|
||||||
|
// initiate effects (in reverse)
|
||||||
|
effects = effectsOver;
|
||||||
|
effectAmount = -effectAmountOver;
|
||||||
|
effectTarget = 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// button triggers
|
||||||
|
if(this->IsClickable())
|
||||||
|
{
|
||||||
|
for(int i=0; i<2; i++)
|
||||||
|
{
|
||||||
|
if(trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan))
|
||||||
|
{
|
||||||
|
// higher 16 bits only (wiimote)
|
||||||
|
s32 wm_btns = t->wpad.btns_d << 16;
|
||||||
|
s32 wm_btns_trig = trigger[i]->wpad.btns_d << 16;
|
||||||
|
|
||||||
|
// lower 16 bits only (classic controller)
|
||||||
|
s32 cc_btns = t->wpad.btns_d >> 16;
|
||||||
|
s32 cc_btns_trig = trigger[i]->wpad.btns_d >> 16;
|
||||||
|
|
||||||
|
if(
|
||||||
|
(t->wpad.btns_d > 0 &&
|
||||||
|
wm_btns == wm_btns_trig ||
|
||||||
|
(cc_btns == cc_btns_trig && t->wpad.exp.type == EXP_CLASSIC)) ||
|
||||||
|
(t->pad.btns_d == trigger[i]->pad.btns_d && t->pad.btns_d > 0))
|
||||||
|
{
|
||||||
|
if(state == STATE_SELECTED)
|
||||||
|
{
|
||||||
|
state = STATE_CLICKED;
|
||||||
|
|
||||||
|
if(soundClick)
|
||||||
|
soundClick->Play();
|
||||||
|
}
|
||||||
|
else if(trigger[i]->type == TRIGGER_BUTTON_ONLY)
|
||||||
|
{
|
||||||
|
state = STATE_CLICKED;
|
||||||
|
}
|
||||||
|
else if(trigger[i]->type == TRIGGER_BUTTON_ONLY_IN_FOCUS &&
|
||||||
|
parentElement->IsFocused())
|
||||||
|
{
|
||||||
|
state = STATE_CLICKED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(updateCB)
|
||||||
|
updateCB(this);
|
||||||
|
}
|
484
source/ngc/gui/gui_element.cpp
Normal file
@ -0,0 +1,484 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_element.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the Object class.
|
||||||
|
*/
|
||||||
|
GuiElement::GuiElement()
|
||||||
|
{
|
||||||
|
xoffset = 0;
|
||||||
|
yoffset = 0;
|
||||||
|
width = 0;
|
||||||
|
height = 0;
|
||||||
|
alpha = 255;
|
||||||
|
scale = 1;
|
||||||
|
state = STATE_DEFAULT;
|
||||||
|
trigger[0] = NULL;
|
||||||
|
trigger[1] = NULL;
|
||||||
|
parentElement = NULL;
|
||||||
|
selectable = false;
|
||||||
|
clickable = false;
|
||||||
|
visible = true;
|
||||||
|
focus = -1; // cannot be focused
|
||||||
|
updateCB = NULL;
|
||||||
|
yoffsetDyn = 0;
|
||||||
|
xoffsetDyn = 0;
|
||||||
|
alphaDyn = -1;
|
||||||
|
scaleDyn = 1;
|
||||||
|
effects = 0;
|
||||||
|
effectAmount = 0;
|
||||||
|
effectTarget = 0;
|
||||||
|
effectsOver = 0;
|
||||||
|
effectAmountOver = 0;
|
||||||
|
effectTargetOver = 0;
|
||||||
|
|
||||||
|
// default alignment - align to top left
|
||||||
|
alignmentVert = ALIGN_TOP;
|
||||||
|
alignmentHor = ALIGN_LEFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiElement class.
|
||||||
|
*/
|
||||||
|
GuiElement::~GuiElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetParent(GuiElement * e)
|
||||||
|
{
|
||||||
|
parentElement = e;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get the left position of the GuiElement.
|
||||||
|
* @see SetLeft()
|
||||||
|
* @return Left position in pixel.
|
||||||
|
*/
|
||||||
|
int GuiElement::GetLeft()
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
int pWidth = 0;
|
||||||
|
int pLeft = 0;
|
||||||
|
|
||||||
|
if(parentElement)
|
||||||
|
{
|
||||||
|
pWidth = parentElement->GetWidth();
|
||||||
|
pLeft = parentElement->GetLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(effects & (EFFECT_SLIDE_IN | EFFECT_SLIDE_OUT))
|
||||||
|
pLeft += xoffsetDyn;
|
||||||
|
|
||||||
|
switch(alignmentHor)
|
||||||
|
{
|
||||||
|
case ALIGN_LEFT:
|
||||||
|
x = pLeft;
|
||||||
|
break;
|
||||||
|
case ALIGN_CENTRE:
|
||||||
|
x = pLeft + (pWidth/2) - (width/2);
|
||||||
|
break;
|
||||||
|
case ALIGN_RIGHT:
|
||||||
|
x = pLeft + pWidth - width;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return x + xoffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the top position of the GuiElement.
|
||||||
|
* @see SetTop()
|
||||||
|
* @return Top position in pixel.
|
||||||
|
*/
|
||||||
|
int GuiElement::GetTop()
|
||||||
|
{
|
||||||
|
int y = 0;
|
||||||
|
int pHeight = 0;
|
||||||
|
int pTop = 0;
|
||||||
|
|
||||||
|
if(parentElement)
|
||||||
|
{
|
||||||
|
pHeight = parentElement->GetHeight();
|
||||||
|
pTop = parentElement->GetTop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(effects & (EFFECT_SLIDE_IN | EFFECT_SLIDE_OUT))
|
||||||
|
pTop += yoffsetDyn;
|
||||||
|
|
||||||
|
switch(alignmentVert)
|
||||||
|
{
|
||||||
|
case ALIGN_TOP:
|
||||||
|
y = pTop;
|
||||||
|
break;
|
||||||
|
case ALIGN_MIDDLE:
|
||||||
|
y = pTop + (pHeight/2) - (height/2);
|
||||||
|
break;
|
||||||
|
case ALIGN_BOTTOM:
|
||||||
|
y = pTop + pHeight - height;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return y + yoffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the width of the GuiElement.
|
||||||
|
* @see SetWidth()
|
||||||
|
* @return Width of the GuiElement.
|
||||||
|
*/
|
||||||
|
int GuiElement::GetWidth()
|
||||||
|
{
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the height of the GuiElement.
|
||||||
|
* @see SetHeight()
|
||||||
|
* @return Height of the GuiElement.
|
||||||
|
*/
|
||||||
|
int GuiElement::GetHeight()
|
||||||
|
{
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the width and height of the GuiElement.
|
||||||
|
* @param[in] Width Width in pixel.
|
||||||
|
* @param[in] Height Height in pixel.
|
||||||
|
* @see SetWidth()
|
||||||
|
* @see SetHeight()
|
||||||
|
*/
|
||||||
|
void GuiElement::SetSize(int w, int h)
|
||||||
|
{
|
||||||
|
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get visible.
|
||||||
|
* @see SetVisible()
|
||||||
|
* @return true if visible, false otherwise.
|
||||||
|
*/
|
||||||
|
bool GuiElement::IsVisible()
|
||||||
|
{
|
||||||
|
return visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set visible.
|
||||||
|
* @param[in] Visible Set to true to show GuiElement.
|
||||||
|
* @see IsVisible()
|
||||||
|
*/
|
||||||
|
void GuiElement::SetVisible(bool v)
|
||||||
|
{
|
||||||
|
visible = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetAlpha(int a)
|
||||||
|
{
|
||||||
|
alpha = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiElement::GetAlpha()
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
|
||||||
|
if(alphaDyn >= 0)
|
||||||
|
a = alphaDyn;
|
||||||
|
else
|
||||||
|
a = alpha;
|
||||||
|
|
||||||
|
if(parentElement)
|
||||||
|
a *= parentElement->GetAlpha()/255.0;
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetScale(float s)
|
||||||
|
{
|
||||||
|
scale = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
float GuiElement::GetScale()
|
||||||
|
{
|
||||||
|
float s = scale * scaleDyn;
|
||||||
|
|
||||||
|
if(parentElement)
|
||||||
|
s *= parentElement->GetScale();
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiElement::GetState()
|
||||||
|
{
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetState(int s)
|
||||||
|
{
|
||||||
|
state = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::ResetState()
|
||||||
|
{
|
||||||
|
if(state != STATE_DISABLED)
|
||||||
|
state = STATE_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetClickable(bool c)
|
||||||
|
{
|
||||||
|
clickable = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetSelectable(bool s)
|
||||||
|
{
|
||||||
|
selectable = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GuiElement::IsSelectable()
|
||||||
|
{
|
||||||
|
if(state == STATE_DISABLED || state == STATE_CLICKED)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return selectable;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GuiElement::IsClickable()
|
||||||
|
{
|
||||||
|
if(state == STATE_DISABLED || state == STATE_CLICKED)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return clickable;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetFocus(int f)
|
||||||
|
{
|
||||||
|
focus = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiElement::IsFocused()
|
||||||
|
{
|
||||||
|
return focus;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetTrigger(GuiTrigger * t)
|
||||||
|
{
|
||||||
|
if(!trigger[0])
|
||||||
|
trigger[0] = t;
|
||||||
|
else if(!trigger[1])
|
||||||
|
trigger[1] = t;
|
||||||
|
else // both were assigned, so we'll just overwrite the first one
|
||||||
|
trigger[0] = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetTrigger(u8 i, GuiTrigger * t)
|
||||||
|
{
|
||||||
|
trigger[i] = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiElement::GetEffect()
|
||||||
|
{
|
||||||
|
return effects;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetEffect(int eff, int amount, int target)
|
||||||
|
{
|
||||||
|
if(eff & EFFECT_SLIDE_IN)
|
||||||
|
{
|
||||||
|
// these calculations overcompensate a little
|
||||||
|
if(eff & EFFECT_SLIDE_TOP)
|
||||||
|
yoffsetDyn = -screenheight;
|
||||||
|
else if(eff & EFFECT_SLIDE_LEFT)
|
||||||
|
xoffsetDyn = -screenwidth;
|
||||||
|
else if(eff & EFFECT_SLIDE_BOTTOM)
|
||||||
|
yoffsetDyn = screenheight;
|
||||||
|
else if(eff & EFFECT_SLIDE_RIGHT)
|
||||||
|
xoffsetDyn = screenwidth;
|
||||||
|
}
|
||||||
|
if(eff & EFFECT_FADE && amount > 0)
|
||||||
|
{
|
||||||
|
alphaDyn = 0;
|
||||||
|
}
|
||||||
|
else if(eff & EFFECT_FADE && amount < 0)
|
||||||
|
{
|
||||||
|
alphaDyn = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
effects |= eff;
|
||||||
|
effectAmount = amount;
|
||||||
|
effectTarget = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetEffectOnOver(int eff, int amount, int target)
|
||||||
|
{
|
||||||
|
effectsOver |= eff;
|
||||||
|
effectAmountOver = amount;
|
||||||
|
effectTargetOver = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetEffectGrow()
|
||||||
|
{
|
||||||
|
SetEffectOnOver(EFFECT_SCALE, 4, 110);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::UpdateEffects()
|
||||||
|
{
|
||||||
|
if(effects & (EFFECT_SLIDE_IN | EFFECT_SLIDE_OUT))
|
||||||
|
{
|
||||||
|
if(effects & EFFECT_SLIDE_IN)
|
||||||
|
{
|
||||||
|
if(effects & EFFECT_SLIDE_LEFT)
|
||||||
|
{
|
||||||
|
xoffsetDyn += effectAmount;
|
||||||
|
|
||||||
|
if(xoffsetDyn >= 0)
|
||||||
|
{
|
||||||
|
xoffsetDyn = 0;
|
||||||
|
effects = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(effects & EFFECT_SLIDE_RIGHT)
|
||||||
|
{
|
||||||
|
xoffsetDyn -= effectAmount;
|
||||||
|
|
||||||
|
if(xoffsetDyn <= 0)
|
||||||
|
{
|
||||||
|
xoffsetDyn = 0;
|
||||||
|
effects = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(effects & EFFECT_SLIDE_TOP)
|
||||||
|
{
|
||||||
|
yoffsetDyn += effectAmount;
|
||||||
|
|
||||||
|
if(yoffsetDyn >= 0)
|
||||||
|
{
|
||||||
|
yoffsetDyn = 0;
|
||||||
|
effects = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(effects & EFFECT_SLIDE_BOTTOM)
|
||||||
|
{
|
||||||
|
yoffsetDyn -= effectAmount;
|
||||||
|
|
||||||
|
if(yoffsetDyn <= 0)
|
||||||
|
{
|
||||||
|
yoffsetDyn = 0;
|
||||||
|
effects = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(effects & EFFECT_SLIDE_LEFT)
|
||||||
|
{
|
||||||
|
xoffsetDyn -= effectAmount;
|
||||||
|
|
||||||
|
if(xoffsetDyn <= -screenwidth)
|
||||||
|
effects = 0; // shut off effect
|
||||||
|
}
|
||||||
|
else if(effects & EFFECT_SLIDE_RIGHT)
|
||||||
|
{
|
||||||
|
xoffsetDyn += effectAmount;
|
||||||
|
|
||||||
|
if(xoffsetDyn >= screenwidth)
|
||||||
|
effects = 0; // shut off effect
|
||||||
|
}
|
||||||
|
else if(effects & EFFECT_SLIDE_TOP)
|
||||||
|
{
|
||||||
|
yoffsetDyn -= effectAmount;
|
||||||
|
|
||||||
|
if(yoffsetDyn <= -screenheight)
|
||||||
|
effects = 0; // shut off effect
|
||||||
|
}
|
||||||
|
else if(effects & EFFECT_SLIDE_BOTTOM)
|
||||||
|
{
|
||||||
|
yoffsetDyn += effectAmount;
|
||||||
|
|
||||||
|
if(yoffsetDyn >= screenheight)
|
||||||
|
effects = 0; // shut off effect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(effects & EFFECT_FADE)
|
||||||
|
{
|
||||||
|
alphaDyn += effectAmount;
|
||||||
|
|
||||||
|
if(effectAmount < 0 && alphaDyn <= 0)
|
||||||
|
{
|
||||||
|
alphaDyn = 0;
|
||||||
|
effects = 0; // shut off effect
|
||||||
|
}
|
||||||
|
else if(effectAmount > 0 && alphaDyn >= alpha)
|
||||||
|
{
|
||||||
|
alphaDyn = alpha;
|
||||||
|
effects = 0; // shut off effect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(effects & EFFECT_SCALE)
|
||||||
|
{
|
||||||
|
scaleDyn += effectAmount/100.0;
|
||||||
|
|
||||||
|
if((effectAmount < 0 && scaleDyn <= effectTarget/100.0)
|
||||||
|
|| (effectAmount > 0 && scaleDyn >= effectTarget/100.0))
|
||||||
|
{
|
||||||
|
scaleDyn = effectTarget/100.0;
|
||||||
|
effects = 0; // shut off effect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::Update(GuiTrigger * t)
|
||||||
|
{
|
||||||
|
if(updateCB)
|
||||||
|
updateCB(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetUpdateCallback(UpdateCallback u)
|
||||||
|
{
|
||||||
|
updateCB = u;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetPosition(int xoff, int yoff)
|
||||||
|
{
|
||||||
|
xoffset = xoff;
|
||||||
|
yoffset = yoff;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiElement::SetAlignment(int hor, int vert)
|
||||||
|
{
|
||||||
|
alignmentHor = hor;
|
||||||
|
alignmentVert = vert;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiElement::GetSelected()
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw an element on screen.
|
||||||
|
*/
|
||||||
|
void GuiElement::Draw()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a position is inside the GuiElement.
|
||||||
|
* @param[in] x X position in pixel.
|
||||||
|
* @param[in] y Y position in pixel.
|
||||||
|
*/
|
||||||
|
bool GuiElement::IsInside(int x, int y)
|
||||||
|
{
|
||||||
|
if(x > this->GetLeft() && x < (this->GetLeft()+width)
|
||||||
|
&& y > this->GetTop() && y < (this->GetTop()+height))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
312
source/ngc/gui/gui_filebrowser.cpp
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_filebrowser.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
#include "filebrowser.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the GuiFileBrowser class.
|
||||||
|
*/
|
||||||
|
GuiFileBrowser::GuiFileBrowser(int w, int h)
|
||||||
|
{
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
selectedItem = 0;
|
||||||
|
selectable = true;
|
||||||
|
listChanged = true; // trigger an initial list update
|
||||||
|
focus = 0; // allow focus
|
||||||
|
|
||||||
|
trigA = new GuiTrigger;
|
||||||
|
if(GCSettings.WiimoteOrientation)
|
||||||
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||||
|
else
|
||||||
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||||
|
|
||||||
|
bgGameSelection = new GuiImageData(bg_game_selection_png);
|
||||||
|
bgGameSelectionImg = new GuiImage(bgGameSelection);
|
||||||
|
bgGameSelectionImg->SetParent(this);
|
||||||
|
bgGameSelectionImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
|
|
||||||
|
bgGameSelectionEntry = new GuiImageData(bg_game_selection_entry_png);
|
||||||
|
gameFolder = new GuiImageData(folder_png);
|
||||||
|
|
||||||
|
scrollbar = new GuiImageData(scrollbar_png);
|
||||||
|
scrollbarImg = new GuiImage(scrollbar);
|
||||||
|
scrollbarImg->SetParent(this);
|
||||||
|
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
scrollbarImg->SetPosition(0, 30);
|
||||||
|
|
||||||
|
arrowDown = new GuiImageData(scrollbar_arrowdown_png);
|
||||||
|
arrowDownImg = new GuiImage(arrowDown);
|
||||||
|
arrowDownOver = new GuiImageData(scrollbar_arrowdown_over_png);
|
||||||
|
arrowDownOverImg = new GuiImage(arrowDownOver);
|
||||||
|
arrowUp = new GuiImageData(scrollbar_arrowup_png);
|
||||||
|
arrowUpImg = new GuiImage(arrowUp);
|
||||||
|
arrowUpOver = new GuiImageData(scrollbar_arrowup_over_png);
|
||||||
|
arrowUpOverImg = new GuiImage(arrowUpOver);
|
||||||
|
scrollbarBox = new GuiImageData(scrollbar_box_png);
|
||||||
|
scrollbarBoxImg = new GuiImage(scrollbarBox);
|
||||||
|
scrollbarBoxOver = new GuiImageData(scrollbar_box_over_png);
|
||||||
|
scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver);
|
||||||
|
|
||||||
|
arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());
|
||||||
|
arrowUpBtn->SetParent(this);
|
||||||
|
arrowUpBtn->SetImage(arrowUpImg);
|
||||||
|
arrowUpBtn->SetImageOver(arrowUpOverImg);
|
||||||
|
arrowUpBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
arrowUpBtn->SetSelectable(false);
|
||||||
|
arrowUpBtn->SetTrigger(trigA);
|
||||||
|
|
||||||
|
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
|
||||||
|
arrowDownBtn->SetParent(this);
|
||||||
|
arrowDownBtn->SetImage(arrowDownImg);
|
||||||
|
arrowDownBtn->SetImageOver(arrowDownOverImg);
|
||||||
|
arrowDownBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||||
|
arrowDownBtn->SetSelectable(false);
|
||||||
|
arrowDownBtn->SetTrigger(trigA);
|
||||||
|
|
||||||
|
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
|
||||||
|
scrollbarBoxBtn->SetParent(this);
|
||||||
|
scrollbarBoxBtn->SetImage(scrollbarBoxImg);
|
||||||
|
scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg);
|
||||||
|
scrollbarBoxBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
scrollbarBoxBtn->SetSelectable(false);
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
gameListText[i] = new GuiText("Game",22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
gameListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
|
gameListText[i]->SetPosition(5,0);
|
||||||
|
|
||||||
|
gameListBg[i] = new GuiImage(bgGameSelectionEntry);
|
||||||
|
gameListFolder[i] = new GuiImage(gameFolder);
|
||||||
|
|
||||||
|
gameList[i] = new GuiButton(380, 30);
|
||||||
|
gameList[i]->SetParent(this);
|
||||||
|
gameList[i]->SetLabel(gameListText[i]);
|
||||||
|
gameList[i]->SetImageOver(gameListBg[i]);
|
||||||
|
gameList[i]->SetPosition(2,30*i+3);
|
||||||
|
gameList[i]->SetTrigger(trigA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiFileBrowser class.
|
||||||
|
*/
|
||||||
|
GuiFileBrowser::~GuiFileBrowser()
|
||||||
|
{
|
||||||
|
delete arrowUpBtn;
|
||||||
|
delete arrowDownBtn;
|
||||||
|
delete scrollbarBoxBtn;
|
||||||
|
|
||||||
|
delete bgGameSelectionImg;
|
||||||
|
delete scrollbarImg;
|
||||||
|
delete arrowDownImg;
|
||||||
|
delete arrowDownOverImg;
|
||||||
|
delete arrowUpImg;
|
||||||
|
delete arrowUpOverImg;
|
||||||
|
delete scrollbarBoxImg;
|
||||||
|
delete scrollbarBoxOverImg;
|
||||||
|
|
||||||
|
delete bgGameSelection;
|
||||||
|
delete bgGameSelectionEntry;
|
||||||
|
delete gameFolder;
|
||||||
|
delete scrollbar;
|
||||||
|
delete arrowDown;
|
||||||
|
delete arrowDownOver;
|
||||||
|
delete arrowUp;
|
||||||
|
delete arrowUpOver;
|
||||||
|
delete scrollbarBox;
|
||||||
|
delete scrollbarBoxOver;
|
||||||
|
|
||||||
|
delete trigA;
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
delete gameListText[i];
|
||||||
|
delete gameList[i];
|
||||||
|
delete gameListBg[i];
|
||||||
|
delete gameListFolder[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiFileBrowser::SetFocus(int f)
|
||||||
|
{
|
||||||
|
focus = f;
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
gameList[i]->ResetState();
|
||||||
|
|
||||||
|
if(f == 1)
|
||||||
|
gameList[selectedItem]->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiFileBrowser::ResetState()
|
||||||
|
{
|
||||||
|
state = STATE_DEFAULT;
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
gameList[i]->ResetState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiFileBrowser::TriggerUpdate()
|
||||||
|
{
|
||||||
|
listChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the button on screen
|
||||||
|
*/
|
||||||
|
void GuiFileBrowser::Draw()
|
||||||
|
{
|
||||||
|
if(!this->IsVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
bgGameSelectionImg->Draw();
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
gameList[i]->Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollbarImg->Draw();
|
||||||
|
arrowUpBtn->Draw();
|
||||||
|
arrowDownBtn->Draw();
|
||||||
|
scrollbarBoxBtn->Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiFileBrowser::Update(GuiTrigger * t)
|
||||||
|
{
|
||||||
|
// update the location of the scroll box based on the position in the file list
|
||||||
|
int position = 136*(browser.pageIndex + selectedItem) / browser.numEntries;
|
||||||
|
scrollbarBoxBtn->SetPosition(0,position+36);
|
||||||
|
|
||||||
|
arrowUpBtn->Update(t);
|
||||||
|
arrowDownBtn->Update(t);
|
||||||
|
scrollbarBoxBtn->Update(t);
|
||||||
|
|
||||||
|
// pad/joystick navigation
|
||||||
|
if(!focus)
|
||||||
|
{
|
||||||
|
goto endNavigation; // skip navigation
|
||||||
|
listChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(t->Right() || arrowDownBtn->GetState() == STATE_CLICKED)
|
||||||
|
{
|
||||||
|
if(browser.pageIndex < browser.numEntries)
|
||||||
|
{
|
||||||
|
browser.pageIndex += PAGESIZE;
|
||||||
|
if(browser.pageIndex+PAGESIZE >= browser.numEntries)
|
||||||
|
browser.pageIndex = browser.numEntries-PAGESIZE;
|
||||||
|
listChanged = true;
|
||||||
|
}
|
||||||
|
arrowDownBtn->ResetState();
|
||||||
|
}
|
||||||
|
else if(t->Left() || arrowUpBtn->GetState() == STATE_CLICKED)
|
||||||
|
{
|
||||||
|
if(browser.pageIndex > 0)
|
||||||
|
{
|
||||||
|
browser.pageIndex -= PAGESIZE;
|
||||||
|
if(browser.pageIndex < 0)
|
||||||
|
browser.pageIndex = 0;
|
||||||
|
listChanged = true;
|
||||||
|
}
|
||||||
|
arrowUpBtn->ResetState();
|
||||||
|
}
|
||||||
|
else if(t->Down())
|
||||||
|
{
|
||||||
|
if(browser.pageIndex + selectedItem + 1 < browser.numEntries)
|
||||||
|
{
|
||||||
|
if(selectedItem == PAGESIZE-1)
|
||||||
|
{
|
||||||
|
// move list down by 1
|
||||||
|
browser.pageIndex++;
|
||||||
|
listChanged = true;
|
||||||
|
}
|
||||||
|
else if(gameList[selectedItem+1]->IsVisible())
|
||||||
|
{
|
||||||
|
gameList[selectedItem]->ResetState();
|
||||||
|
gameList[++selectedItem]->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(t->Up())
|
||||||
|
{
|
||||||
|
if(selectedItem == 0 && browser.pageIndex + selectedItem > 0)
|
||||||
|
{
|
||||||
|
// move list up by 1
|
||||||
|
browser.pageIndex--;
|
||||||
|
listChanged = true;
|
||||||
|
}
|
||||||
|
else if(selectedItem > 0)
|
||||||
|
{
|
||||||
|
gameList[selectedItem]->ResetState();
|
||||||
|
gameList[--selectedItem]->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
endNavigation:
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
if(listChanged)
|
||||||
|
{
|
||||||
|
if(browser.pageIndex+i < browser.numEntries)
|
||||||
|
{
|
||||||
|
if(gameList[i]->GetState() == STATE_DISABLED)
|
||||||
|
gameList[i]->SetState(STATE_DEFAULT);
|
||||||
|
|
||||||
|
gameList[i]->SetVisible(true);
|
||||||
|
|
||||||
|
gameListText[i]->SetText(browserList[browser.pageIndex+i].displayname);
|
||||||
|
|
||||||
|
if(browserList[browser.pageIndex+i].isdir) // directory
|
||||||
|
{
|
||||||
|
gameList[i]->SetIcon(gameListFolder[i]);
|
||||||
|
gameListText[i]->SetPosition(30,0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gameList[i]->SetIcon(NULL);
|
||||||
|
gameListText[i]->SetPosition(10,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gameList[i]->SetVisible(false);
|
||||||
|
gameList[i]->SetState(STATE_DISABLED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(focus)
|
||||||
|
{
|
||||||
|
if(i != selectedItem && gameList[i]->GetState() == STATE_SELECTED)
|
||||||
|
gameList[i]->ResetState();
|
||||||
|
else if(i == selectedItem && gameList[i]->GetState() == STATE_DEFAULT)
|
||||||
|
gameList[selectedItem]->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
gameList[i]->Update(t);
|
||||||
|
|
||||||
|
if(gameList[i]->GetState() == STATE_SELECTED)
|
||||||
|
{
|
||||||
|
selectedItem = i;
|
||||||
|
browser.selIndex = browser.pageIndex + i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
listChanged = false;
|
||||||
|
|
||||||
|
if(updateCB)
|
||||||
|
updateCB(this);
|
||||||
|
}
|
218
source/ngc/gui/gui_image.cpp
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_image.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
/**
|
||||||
|
* Constructor for the GuiImage class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
GuiImage::GuiImage(GuiImageData * img)
|
||||||
|
{
|
||||||
|
image = img->GetImage();
|
||||||
|
width = img->GetWidth();
|
||||||
|
height = img->GetHeight();
|
||||||
|
imageangle = 0;
|
||||||
|
tile = 0;
|
||||||
|
stripe = 0;
|
||||||
|
imgType = IMAGE_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiImage::GuiImage(u8 * img, int w, int h)
|
||||||
|
{
|
||||||
|
image = img;
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
imageangle = 0;
|
||||||
|
tile = 0;
|
||||||
|
stripe = 0;
|
||||||
|
imgType = IMAGE_TEXTURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiImage::GuiImage(int w, int h, GXColor c)
|
||||||
|
{
|
||||||
|
image = (u8 *)memalign (32, w * h * 4);
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
imageangle = 0;
|
||||||
|
tile = 0;
|
||||||
|
stripe = 0;
|
||||||
|
imgType = IMAGE_COLOR;
|
||||||
|
|
||||||
|
if(!image)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
for(y=0; y < h; y++)
|
||||||
|
{
|
||||||
|
for(x=0; x < w; x++)
|
||||||
|
{
|
||||||
|
this->SetPixel(x, y, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DCFlushRange(image, w * h * 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiImage class.
|
||||||
|
*/
|
||||||
|
GuiImage::~GuiImage()
|
||||||
|
{
|
||||||
|
if(imgType == IMAGE_COLOR && image)
|
||||||
|
free(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 * GuiImage::GetImage()
|
||||||
|
{
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiImage::SetImage(GuiImageData * img)
|
||||||
|
{
|
||||||
|
image = img->GetImage();
|
||||||
|
width = img->GetWidth();
|
||||||
|
height = img->GetHeight();
|
||||||
|
imgType = IMAGE_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiImage::SetImage(u8 * img, int w, int h)
|
||||||
|
{
|
||||||
|
image = img;
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
imgType = IMAGE_TEXTURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiImage::SetAngle(float a)
|
||||||
|
{
|
||||||
|
imageangle = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiImage::SetTile(int t)
|
||||||
|
{
|
||||||
|
tile = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
GXColor GuiImage::GetPixel(int x, int y)
|
||||||
|
{
|
||||||
|
if(!image || this->GetWidth() <= 0 || x < 0 || y < 0)
|
||||||
|
return (GXColor){0, 0, 0, 0};
|
||||||
|
|
||||||
|
u32 offset = (((y >> 2)<<4)*this->GetWidth()) + ((x >> 2)<<6) + (((y%4 << 2) + x%4 ) << 1);
|
||||||
|
GXColor color;
|
||||||
|
color.a = *(image+offset);
|
||||||
|
color.r = *(image+offset+1);
|
||||||
|
color.g = *(image+offset+32);
|
||||||
|
color.b = *(image+offset+33);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiImage::SetPixel(int x, int y, GXColor color)
|
||||||
|
{
|
||||||
|
if(!image || this->GetWidth() <= 0 || x < 0 || y < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
u32 offset = (((y >> 2)<<4)*this->GetWidth()) + ((x >> 2)<<6) + (((y%4 << 2) + x%4 ) << 1);
|
||||||
|
*(image+offset) = color.a;
|
||||||
|
*(image+offset+1) = color.r;
|
||||||
|
*(image+offset+32) = color.g;
|
||||||
|
*(image+offset+33) = color.b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiImage::SetStripe(int s)
|
||||||
|
{
|
||||||
|
stripe = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiImage::ColorStripe(int shift)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
GXColor color;
|
||||||
|
int alt = 0;
|
||||||
|
|
||||||
|
for(y=0; y < this->GetHeight(); y++)
|
||||||
|
{
|
||||||
|
if(y % 3 == 0)
|
||||||
|
alt ^= 1;
|
||||||
|
|
||||||
|
for(x=0; x < this->GetWidth(); x++)
|
||||||
|
{
|
||||||
|
color = GetPixel(x, y);
|
||||||
|
|
||||||
|
if(alt)
|
||||||
|
{
|
||||||
|
if(color.r < 255-shift)
|
||||||
|
color.r += shift;
|
||||||
|
else
|
||||||
|
color.r = 255;
|
||||||
|
if(color.g < 255-shift)
|
||||||
|
color.g += shift;
|
||||||
|
else
|
||||||
|
color.g = 255;
|
||||||
|
if(color.b < 255-shift)
|
||||||
|
color.b += shift;
|
||||||
|
else
|
||||||
|
color.b = 255;
|
||||||
|
|
||||||
|
color.a = 255;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(color.r > shift)
|
||||||
|
color.r -= shift;
|
||||||
|
else
|
||||||
|
color.r = 0;
|
||||||
|
if(color.g > shift)
|
||||||
|
color.g -= shift;
|
||||||
|
else
|
||||||
|
color.g = 0;
|
||||||
|
if(color.b > shift)
|
||||||
|
color.b -= shift;
|
||||||
|
else
|
||||||
|
color.b = 0;
|
||||||
|
|
||||||
|
color.a = 255;
|
||||||
|
}
|
||||||
|
SetPixel(x, y, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the button on screen
|
||||||
|
*/
|
||||||
|
void GuiImage::Draw()
|
||||||
|
{
|
||||||
|
if(!image || !this->IsVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
float currScale = this->GetScale();
|
||||||
|
int currLeft = this->GetLeft();
|
||||||
|
|
||||||
|
if(tile > 0)
|
||||||
|
{
|
||||||
|
for(int i=0; i<tile; i++)
|
||||||
|
Menu_DrawImg(currLeft+width*i, this->GetTop(), width, height, image, imageangle, currScale, currScale, this->GetAlpha());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// temporary (maybe), used to correct offset for scaled images
|
||||||
|
if(scale != 1)
|
||||||
|
currLeft = currLeft - width/2 + (width*scale)/2;
|
||||||
|
|
||||||
|
Menu_DrawImg(currLeft, this->GetTop(), width, height, image, imageangle, currScale, currScale, this->GetAlpha());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stripe > 0)
|
||||||
|
for(int y=0; y < this->GetHeight(); y+=6)
|
||||||
|
Menu_DrawRectangle(currLeft,this->GetTop()+y,this->GetWidth(),3,(GXColor){0, 0, 0, stripe},1);
|
||||||
|
|
||||||
|
this->UpdateEffects();
|
||||||
|
}
|
65
source/ngc/gui/gui_imagedata.cpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_imagedata.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the GuiImageData class.
|
||||||
|
*/
|
||||||
|
GuiImageData::GuiImageData(const u8 * img)
|
||||||
|
{
|
||||||
|
if(img == NULL)
|
||||||
|
{
|
||||||
|
data = NULL;
|
||||||
|
width = 0;
|
||||||
|
height = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PNGUPROP imgProp;
|
||||||
|
IMGCTX ctx;
|
||||||
|
|
||||||
|
ctx = PNGU_SelectImageFromBuffer(img);
|
||||||
|
PNGU_GetImageProperties (ctx, &imgProp);
|
||||||
|
width = imgProp.imgWidth;
|
||||||
|
height = imgProp.imgHeight;
|
||||||
|
data = (u8 *)memalign (32, imgProp.imgWidth * imgProp.imgHeight * 4);
|
||||||
|
PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
|
||||||
|
PNGU_ReleaseImageContext (ctx);
|
||||||
|
DCFlushRange (data, imgProp.imgWidth * imgProp.imgHeight * 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiImageData class.
|
||||||
|
*/
|
||||||
|
GuiImageData::~GuiImageData()
|
||||||
|
{
|
||||||
|
if(data)
|
||||||
|
{
|
||||||
|
free(data);
|
||||||
|
data = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 * GuiImageData::GetImage()
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiImageData::GetWidth()
|
||||||
|
{
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiImageData::GetHeight()
|
||||||
|
{
|
||||||
|
return height;
|
||||||
|
}
|
300
source/ngc/gui/gui_keyboard.cpp
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_keyboard.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
/**
|
||||||
|
* Constructor for the GuiKeyboard class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
GuiKeyboard::GuiKeyboard(char * t)
|
||||||
|
{
|
||||||
|
width = 540;
|
||||||
|
height = 400;
|
||||||
|
shift = 0;
|
||||||
|
caps = 0;
|
||||||
|
selectable = true;
|
||||||
|
focus = 0; // allow focus
|
||||||
|
alignmentHor = ALIGN_CENTRE;
|
||||||
|
alignmentVert = ALIGN_MIDDLE;
|
||||||
|
strncpy(kbtextstr, t, 100);
|
||||||
|
kbtextstr[100] = 0;
|
||||||
|
|
||||||
|
Key thekeys[4][10] = {
|
||||||
|
{
|
||||||
|
{'1','!'},
|
||||||
|
{'2','@'},
|
||||||
|
{'3','#'},
|
||||||
|
{'4','$'},
|
||||||
|
{'5','%'},
|
||||||
|
{'6','^'},
|
||||||
|
{'7','&'},
|
||||||
|
{'8','*'},
|
||||||
|
{'9','('},
|
||||||
|
{'0',')'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{'q','Q'},
|
||||||
|
{'w','W'},
|
||||||
|
{'e','E'},
|
||||||
|
{'r','R'},
|
||||||
|
{'t','T'},
|
||||||
|
{'y','Y'},
|
||||||
|
{'u','U'},
|
||||||
|
{'i','I'},
|
||||||
|
{'o','O'},
|
||||||
|
{'p','P'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{'a','A'},
|
||||||
|
{'s','S'},
|
||||||
|
{'d','D'},
|
||||||
|
{'f','F'},
|
||||||
|
{'g','G'},
|
||||||
|
{'h','H'},
|
||||||
|
{'j','J'},
|
||||||
|
{'k','K'},
|
||||||
|
{'l','L'},
|
||||||
|
{':',';'}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
{'z','Z'},
|
||||||
|
{'x','X'},
|
||||||
|
{'c','C'},
|
||||||
|
{'v','V'},
|
||||||
|
{'b','B'},
|
||||||
|
{'n','N'},
|
||||||
|
{'m','M'},
|
||||||
|
{',','<'},
|
||||||
|
{'.','>'},
|
||||||
|
{'/','?'}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
memcpy(keys, thekeys, sizeof(thekeys));
|
||||||
|
|
||||||
|
keyTextbox = new GuiImageData(keyboard_textbox_png);
|
||||||
|
keyTextboxImg = new GuiImage(keyTextbox);
|
||||||
|
keyTextboxImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
|
keyTextboxImg->SetPosition(0, 0);
|
||||||
|
this->Append(keyTextboxImg);
|
||||||
|
|
||||||
|
kbText = new GuiText(kbtextstr, 22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
kbText->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
|
kbText->SetPosition(0, 10);
|
||||||
|
this->Append(kbText);
|
||||||
|
|
||||||
|
key = new GuiImageData(keyboard_key_png);
|
||||||
|
keyOver = new GuiImageData(keyboard_key_over_png);
|
||||||
|
keyMedium = new GuiImageData(keyboard_mediumkey_png);
|
||||||
|
keyMediumOver = new GuiImageData(keyboard_mediumkey_over_png);
|
||||||
|
keyLarge = new GuiImageData(keyboard_largekey_png);
|
||||||
|
keyLargeOver = new GuiImageData(keyboard_largekey_over_png);
|
||||||
|
|
||||||
|
keySoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
||||||
|
trigA = new GuiTrigger;
|
||||||
|
|
||||||
|
if(GCSettings.WiimoteOrientation)
|
||||||
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||||
|
else
|
||||||
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||||
|
|
||||||
|
keyBackImg = new GuiImage(keyMedium);
|
||||||
|
keyBackOverImg = new GuiImage(keyMediumOver);
|
||||||
|
keyBackText = new GuiText("Back", 22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
keyBack = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||||
|
keyBack->SetImage(keyBackImg);
|
||||||
|
keyBack->SetImageOver(keyBackOverImg);
|
||||||
|
keyBack->SetLabel(keyBackText);
|
||||||
|
keyBack->SetSoundOver(keySoundOver);
|
||||||
|
keyBack->SetTrigger(trigA);
|
||||||
|
keyBack->SetPosition(10*42+40, 0*42+80);
|
||||||
|
keyBack->SetEffectGrow();
|
||||||
|
this->Append(keyBack);
|
||||||
|
|
||||||
|
keyCapsImg = new GuiImage(keyMedium);
|
||||||
|
keyCapsOverImg = new GuiImage(keyMediumOver);
|
||||||
|
keyCapsText = new GuiText("Caps", 22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
keyCaps = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||||
|
keyCaps->SetImage(keyCapsImg);
|
||||||
|
keyCaps->SetImageOver(keyCapsOverImg);
|
||||||
|
keyCaps->SetLabel(keyCapsText);
|
||||||
|
keyCaps->SetSoundOver(keySoundOver);
|
||||||
|
keyCaps->SetTrigger(trigA);
|
||||||
|
keyCaps->SetPosition(0, 2*42+80);
|
||||||
|
keyCaps->SetEffectGrow();
|
||||||
|
this->Append(keyCaps);
|
||||||
|
|
||||||
|
keyShiftImg = new GuiImage(keyMedium);
|
||||||
|
keyShiftOverImg = new GuiImage(keyMediumOver);
|
||||||
|
keyShiftText = new GuiText("Shift", 22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
keyShift = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||||
|
keyShift->SetImage(keyShiftImg);
|
||||||
|
keyShift->SetImageOver(keyShiftOverImg);
|
||||||
|
keyShift->SetLabel(keyShiftText);
|
||||||
|
keyShift->SetSoundOver(keySoundOver);
|
||||||
|
keyShift->SetTrigger(trigA);
|
||||||
|
keyShift->SetPosition(21, 3*42+80);
|
||||||
|
keyShift->SetEffectGrow();
|
||||||
|
this->Append(keyShift);
|
||||||
|
|
||||||
|
keySpaceImg = new GuiImage(keyLarge);
|
||||||
|
keySpaceOverImg = new GuiImage(keyLargeOver);
|
||||||
|
keySpace = new GuiButton(keyLarge->GetWidth(), keyLarge->GetHeight());
|
||||||
|
keySpace->SetImage(keySpaceImg);
|
||||||
|
keySpace->SetImageOver(keySpaceOverImg);
|
||||||
|
keySpace->SetSoundOver(keySoundOver);
|
||||||
|
keySpace->SetTrigger(trigA);
|
||||||
|
keySpace->SetPosition(0, 4*42+80);
|
||||||
|
keySpace->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
|
keySpace->SetEffectGrow();
|
||||||
|
this->Append(keySpace);
|
||||||
|
|
||||||
|
for(int i=0; i<4; i++)
|
||||||
|
{
|
||||||
|
for(int j=0; j<10; j++)
|
||||||
|
{
|
||||||
|
keyImg[i][j] = new GuiImage(key);
|
||||||
|
keyImgOver[i][j] = new GuiImage(keyOver);
|
||||||
|
keyTxt[i][j] = new GuiText(NULL, 22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
keyBtn[i][j] = new GuiButton(key->GetWidth(), key->GetHeight());
|
||||||
|
keyBtn[i][j]->SetImage(keyImg[i][j]);
|
||||||
|
keyBtn[i][j]->SetImageOver(keyImgOver[i][j]);
|
||||||
|
keyBtn[i][j]->SetSoundOver(keySoundOver);
|
||||||
|
keyBtn[i][j]->SetTrigger(trigA);
|
||||||
|
keyBtn[i][j]->SetLabel(keyTxt[i][j]);
|
||||||
|
keyBtn[i][j]->SetPosition(j*42+21*i+40, i*42+80);
|
||||||
|
keyBtn[i][j]->SetEffectGrow();
|
||||||
|
this->Append(keyBtn[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiKeyboard class.
|
||||||
|
*/
|
||||||
|
GuiKeyboard::~GuiKeyboard()
|
||||||
|
{
|
||||||
|
delete kbText;
|
||||||
|
delete keyTextbox;
|
||||||
|
delete keyTextboxImg;
|
||||||
|
delete keyCapsText;
|
||||||
|
delete keyCapsImg;
|
||||||
|
delete keyCapsOverImg;
|
||||||
|
delete keyCaps;
|
||||||
|
delete keyShiftText;
|
||||||
|
delete keyShiftImg;
|
||||||
|
delete keyShiftOverImg;
|
||||||
|
delete keyShift;
|
||||||
|
delete keyBackText;
|
||||||
|
delete keyBackImg;
|
||||||
|
delete keyBackOverImg;
|
||||||
|
delete keyBack;
|
||||||
|
delete keySpaceImg;
|
||||||
|
delete keySpaceOverImg;
|
||||||
|
delete keySpace;
|
||||||
|
delete key;
|
||||||
|
delete keyOver;
|
||||||
|
delete keyMedium;
|
||||||
|
delete keyMediumOver;
|
||||||
|
delete keyLarge;
|
||||||
|
delete keyLargeOver;
|
||||||
|
delete keySoundOver;
|
||||||
|
delete trigA;
|
||||||
|
|
||||||
|
for(int i=0; i<4; i++)
|
||||||
|
{
|
||||||
|
for(int j=0; j<10; j++)
|
||||||
|
{
|
||||||
|
delete keyImg[i][j];
|
||||||
|
delete keyImgOver[i][j];
|
||||||
|
delete keyTxt[i][j];
|
||||||
|
delete keyBtn[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiKeyboard::Update(GuiTrigger * t)
|
||||||
|
{
|
||||||
|
if(_elements.size() == 0 || (state == STATE_DISABLED && parentElement))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (u8 i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try { _elements.at(i)->Update(t); }
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
if(keySpace->GetState() == STATE_CLICKED)
|
||||||
|
{
|
||||||
|
kbtextstr[strlen(kbtextstr)] = ' ';
|
||||||
|
kbText->SetText(kbtextstr);
|
||||||
|
keySpace->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
else if(keyBack->GetState() == STATE_CLICKED)
|
||||||
|
{
|
||||||
|
kbtextstr[strlen(kbtextstr)-1] = 0;
|
||||||
|
kbText->SetText(kbtextstr);
|
||||||
|
keyBack->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
else if(keyShift->GetState() == STATE_CLICKED)
|
||||||
|
{
|
||||||
|
shift ^= 1;
|
||||||
|
keyShift->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
else if(keyCaps->GetState() == STATE_CLICKED)
|
||||||
|
{
|
||||||
|
caps ^= 1;
|
||||||
|
keyCaps->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
char txt[2] = { 0, 0 };
|
||||||
|
|
||||||
|
for(int i=0; i<4; i++)
|
||||||
|
{
|
||||||
|
for(int j=0; j<10; j++)
|
||||||
|
{
|
||||||
|
if(shift || caps)
|
||||||
|
txt[0] = keys[i][j].chShift;
|
||||||
|
else
|
||||||
|
txt[0] = keys[i][j].ch;
|
||||||
|
|
||||||
|
keyTxt[i][j]->SetText(txt);
|
||||||
|
|
||||||
|
if(keyBtn[i][j]->GetState() == STATE_CLICKED)
|
||||||
|
{
|
||||||
|
if(shift || caps)
|
||||||
|
{
|
||||||
|
kbtextstr[strlen(kbtextstr)] = keys[i][j].chShift;
|
||||||
|
if(shift) shift ^= 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
kbtextstr[strlen(kbtextstr)] = keys[i][j].ch;
|
||||||
|
|
||||||
|
kbText->SetText(kbtextstr);
|
||||||
|
keyBtn[i][j]->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->ToggleFocus(t);
|
||||||
|
|
||||||
|
if(focus) // only send actions to this window if it's in focus
|
||||||
|
{
|
||||||
|
// pad/joystick navigation
|
||||||
|
if(t->Right())
|
||||||
|
this->MoveSelectionHor(1);
|
||||||
|
else if(t->Left())
|
||||||
|
this->MoveSelectionHor(-1);
|
||||||
|
else if(t->Down())
|
||||||
|
this->MoveSelectionVert(1);
|
||||||
|
else if(t->Up())
|
||||||
|
this->MoveSelectionVert(-1);
|
||||||
|
}
|
||||||
|
}
|
330
source/ngc/gui/gui_optionbrowser.cpp
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_optionbrowser.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
#include "filebrowser.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the GuiOptionBrowser class.
|
||||||
|
*/
|
||||||
|
GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l)
|
||||||
|
{
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
options = l;
|
||||||
|
selectable = true;
|
||||||
|
listOffset = this->FindMenuItem(-1, 1);
|
||||||
|
selectedItem = 0;
|
||||||
|
focus = 0; // allow focus
|
||||||
|
|
||||||
|
trigA = new GuiTrigger;
|
||||||
|
if(GCSettings.WiimoteOrientation)
|
||||||
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||||
|
else
|
||||||
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||||
|
|
||||||
|
bgOptions = new GuiImageData(bg_options_png);
|
||||||
|
bgOptionsImg = new GuiImage(bgOptions);
|
||||||
|
bgOptionsImg->SetParent(this);
|
||||||
|
bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
|
|
||||||
|
bgOptionsEntry = new GuiImageData(bg_options_entry_png);
|
||||||
|
|
||||||
|
scrollbar = new GuiImageData(scrollbar_png);
|
||||||
|
scrollbarImg = new GuiImage(scrollbar);
|
||||||
|
scrollbarImg->SetParent(this);
|
||||||
|
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
scrollbarImg->SetPosition(0, 30);
|
||||||
|
|
||||||
|
arrowDown = new GuiImageData(scrollbar_arrowdown_png);
|
||||||
|
arrowDownImg = new GuiImage(arrowDown);
|
||||||
|
arrowDownOver = new GuiImageData(scrollbar_arrowdown_over_png);
|
||||||
|
arrowDownOverImg = new GuiImage(arrowDownOver);
|
||||||
|
arrowUp = new GuiImageData(scrollbar_arrowup_png);
|
||||||
|
arrowUpImg = new GuiImage(arrowUp);
|
||||||
|
arrowUpOver = new GuiImageData(scrollbar_arrowup_over_png);
|
||||||
|
arrowUpOverImg = new GuiImage(arrowUpOver);
|
||||||
|
scrollbarBox = new GuiImageData(scrollbar_box_png);
|
||||||
|
scrollbarBoxImg = new GuiImage(scrollbarBox);
|
||||||
|
scrollbarBoxOver = new GuiImageData(scrollbar_box_over_png);
|
||||||
|
scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver);
|
||||||
|
|
||||||
|
arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());
|
||||||
|
arrowUpBtn->SetParent(this);
|
||||||
|
arrowUpBtn->SetImage(arrowUpImg);
|
||||||
|
arrowUpBtn->SetImageOver(arrowUpOverImg);
|
||||||
|
arrowUpBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
arrowUpBtn->SetSelectable(false);
|
||||||
|
arrowUpBtn->SetTrigger(trigA);
|
||||||
|
|
||||||
|
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
|
||||||
|
arrowDownBtn->SetParent(this);
|
||||||
|
arrowDownBtn->SetImage(arrowDownImg);
|
||||||
|
arrowDownBtn->SetImageOver(arrowDownOverImg);
|
||||||
|
arrowDownBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||||
|
arrowDownBtn->SetSelectable(false);
|
||||||
|
arrowDownBtn->SetTrigger(trigA);
|
||||||
|
|
||||||
|
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
|
||||||
|
scrollbarBoxBtn->SetParent(this);
|
||||||
|
scrollbarBoxBtn->SetImage(scrollbarBoxImg);
|
||||||
|
scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg);
|
||||||
|
scrollbarBoxBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
scrollbarBoxBtn->SetSelectable(false);
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
optionTxt[i] = new GuiText(options->name[i], 22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
|
optionTxt[i]->SetPosition(8,0);
|
||||||
|
|
||||||
|
optionVal[i] = new GuiText(NULL, 22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
|
optionVal[i]->SetPosition(250,0);
|
||||||
|
|
||||||
|
optionBg[i] = new GuiImage(bgOptionsEntry);
|
||||||
|
|
||||||
|
optionBtn[i] = new GuiButton(552,30);
|
||||||
|
optionBtn[i]->SetParent(this);
|
||||||
|
optionBtn[i]->SetLabel(optionTxt[i], 0);
|
||||||
|
optionBtn[i]->SetLabel(optionVal[i], 1);
|
||||||
|
optionBtn[i]->SetImageOver(optionBg[i]);
|
||||||
|
optionBtn[i]->SetPosition(0,30*i+3);
|
||||||
|
optionBtn[i]->SetTrigger(trigA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiOptionBrowser class.
|
||||||
|
*/
|
||||||
|
GuiOptionBrowser::~GuiOptionBrowser()
|
||||||
|
{
|
||||||
|
delete arrowUpBtn;
|
||||||
|
delete arrowDownBtn;
|
||||||
|
delete scrollbarBoxBtn;
|
||||||
|
|
||||||
|
delete bgOptionsImg;
|
||||||
|
delete scrollbarImg;
|
||||||
|
delete arrowDownImg;
|
||||||
|
delete arrowDownOverImg;
|
||||||
|
delete arrowUpImg;
|
||||||
|
delete arrowUpOverImg;
|
||||||
|
delete scrollbarBoxImg;
|
||||||
|
delete scrollbarBoxOverImg;
|
||||||
|
|
||||||
|
delete bgOptions;
|
||||||
|
delete bgOptionsEntry;
|
||||||
|
delete scrollbar;
|
||||||
|
delete arrowDown;
|
||||||
|
delete arrowDownOver;
|
||||||
|
delete arrowUp;
|
||||||
|
delete arrowUpOver;
|
||||||
|
delete scrollbarBox;
|
||||||
|
delete scrollbarBoxOver;
|
||||||
|
|
||||||
|
delete trigA;
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
delete optionTxt[i];
|
||||||
|
delete optionVal[i];
|
||||||
|
delete optionBg[i];
|
||||||
|
delete optionBtn[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiOptionBrowser::SetCol2Position(int x)
|
||||||
|
{
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
optionVal[i]->SetPosition(x,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiOptionBrowser::SetFocus(int f)
|
||||||
|
{
|
||||||
|
focus = f;
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
optionBtn[i]->ResetState();
|
||||||
|
|
||||||
|
if(f == 1)
|
||||||
|
optionBtn[selectedItem]->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiOptionBrowser::ResetState()
|
||||||
|
{
|
||||||
|
if(state != STATE_DISABLED)
|
||||||
|
state = STATE_DEFAULT;
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
optionBtn[i]->ResetState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiOptionBrowser::GetClickedOption()
|
||||||
|
{
|
||||||
|
int found = -1;
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
if(optionBtn[i]->GetState() == STATE_CLICKED)
|
||||||
|
{
|
||||||
|
optionBtn[i]->SetState(STATE_SELECTED);
|
||||||
|
found = optionIndex[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* FindMenuItem
|
||||||
|
*
|
||||||
|
* Help function to find the next visible menu item on the list
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
int GuiOptionBrowser::FindMenuItem(int currentItem, int direction)
|
||||||
|
{
|
||||||
|
int nextItem = currentItem + direction;
|
||||||
|
|
||||||
|
if(nextItem < 0 || nextItem >= options->length)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if(strlen(options->name[nextItem]) > 0)
|
||||||
|
return nextItem;
|
||||||
|
else
|
||||||
|
return FindMenuItem(nextItem, direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the button on screen
|
||||||
|
*/
|
||||||
|
void GuiOptionBrowser::Draw()
|
||||||
|
{
|
||||||
|
if(!this->IsVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
bgOptionsImg->Draw();
|
||||||
|
|
||||||
|
int next = listOffset;
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
if(next >= 0)
|
||||||
|
{
|
||||||
|
optionBtn[i]->Draw();
|
||||||
|
next = this->FindMenuItem(next, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollbarImg->Draw();
|
||||||
|
arrowUpBtn->Draw();
|
||||||
|
arrowDownBtn->Draw();
|
||||||
|
scrollbarBoxBtn->Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiOptionBrowser::Update(GuiTrigger * t)
|
||||||
|
{
|
||||||
|
int next, prev;
|
||||||
|
|
||||||
|
// update the location of the scroll box based on the position in the option list
|
||||||
|
int position = 136*(browser.pageIndex + selectedItem) / browser.numEntries;
|
||||||
|
scrollbarBoxBtn->SetPosition(0,position+36);
|
||||||
|
|
||||||
|
arrowUpBtn->Update(t);
|
||||||
|
arrowDownBtn->Update(t);
|
||||||
|
scrollbarBoxBtn->Update(t);
|
||||||
|
|
||||||
|
next = listOffset;
|
||||||
|
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
|
{
|
||||||
|
if(next >= 0)
|
||||||
|
{
|
||||||
|
if(optionBtn[i]->GetState() == STATE_DISABLED)
|
||||||
|
{
|
||||||
|
optionBtn[i]->SetVisible(true);
|
||||||
|
optionBtn[i]->SetState(STATE_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
optionTxt[i]->SetText(options->name[next]);
|
||||||
|
optionVal[i]->SetText(options->value[next]);
|
||||||
|
optionIndex[i] = next;
|
||||||
|
next = this->FindMenuItem(next, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
optionBtn[i]->SetVisible(false);
|
||||||
|
optionBtn[i]->SetState(STATE_DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(focus)
|
||||||
|
{
|
||||||
|
if(i != selectedItem && optionBtn[i]->GetState() == STATE_SELECTED)
|
||||||
|
optionBtn[i]->ResetState();
|
||||||
|
else if(i == selectedItem && optionBtn[i]->GetState() == STATE_DEFAULT)
|
||||||
|
optionBtn[selectedItem]->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
optionBtn[i]->Update(t);
|
||||||
|
|
||||||
|
if(optionBtn[i]->GetState() == STATE_SELECTED)
|
||||||
|
{
|
||||||
|
selectedItem = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// pad/joystick navigation
|
||||||
|
if(!focus)
|
||||||
|
return; // skip navigation
|
||||||
|
|
||||||
|
if(t->Down())
|
||||||
|
{
|
||||||
|
next = this->FindMenuItem(optionIndex[selectedItem], 1);
|
||||||
|
|
||||||
|
if(next >= 0)
|
||||||
|
{
|
||||||
|
if(selectedItem == PAGESIZE-1)
|
||||||
|
{
|
||||||
|
// move list down by 1
|
||||||
|
listOffset = this->FindMenuItem(listOffset, 1);
|
||||||
|
}
|
||||||
|
else if(optionBtn[selectedItem+1]->IsVisible())
|
||||||
|
{
|
||||||
|
optionBtn[selectedItem]->ResetState();
|
||||||
|
optionBtn[selectedItem+1]->SetState(STATE_SELECTED);
|
||||||
|
selectedItem++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(t->Up())
|
||||||
|
{
|
||||||
|
prev = this->FindMenuItem(optionIndex[selectedItem], -1);
|
||||||
|
|
||||||
|
if(prev >= 0)
|
||||||
|
{
|
||||||
|
if(selectedItem == 0)
|
||||||
|
{
|
||||||
|
// move list up by 1
|
||||||
|
listOffset = prev;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
optionBtn[selectedItem]->ResetState();
|
||||||
|
optionBtn[selectedItem-1]->SetState(STATE_SELECTED);
|
||||||
|
selectedItem--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(updateCB)
|
||||||
|
updateCB(this);
|
||||||
|
}
|
397
source/ngc/gui/gui_savebrowser.cpp
Normal file
@ -0,0 +1,397 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_savebrowser.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
#include "filebrowser.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the GuiSaveBrowser class.
|
||||||
|
*/
|
||||||
|
GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
|
||||||
|
{
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
saves = s;
|
||||||
|
action = a;
|
||||||
|
selectable = true;
|
||||||
|
|
||||||
|
if(action == 0) // save
|
||||||
|
listOffset = 0;
|
||||||
|
else
|
||||||
|
listOffset = -2;
|
||||||
|
|
||||||
|
selectedItem = 0;
|
||||||
|
focus = 0; // allow focus
|
||||||
|
|
||||||
|
trigA = new GuiTrigger;
|
||||||
|
|
||||||
|
if(GCSettings.WiimoteOrientation)
|
||||||
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||||
|
else
|
||||||
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||||
|
|
||||||
|
gameSave = new GuiImageData(button_gamesave_png);
|
||||||
|
gameSaveOver = new GuiImageData(button_gamesave_over_png);
|
||||||
|
gameSaveBlank = new GuiImageData(button_gamesave_blank_png);
|
||||||
|
|
||||||
|
scrollbar = new GuiImageData(scrollbar_png);
|
||||||
|
scrollbarImg = new GuiImage(scrollbar);
|
||||||
|
scrollbarImg->SetParent(this);
|
||||||
|
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
scrollbarImg->SetPosition(0, 30);
|
||||||
|
|
||||||
|
arrowDown = new GuiImageData(scrollbar_arrowdown_png);
|
||||||
|
arrowDownImg = new GuiImage(arrowDown);
|
||||||
|
arrowDownOver = new GuiImageData(scrollbar_arrowdown_over_png);
|
||||||
|
arrowDownOverImg = new GuiImage(arrowDownOver);
|
||||||
|
arrowUp = new GuiImageData(scrollbar_arrowup_png);
|
||||||
|
arrowUpImg = new GuiImage(arrowUp);
|
||||||
|
arrowUpOver = new GuiImageData(scrollbar_arrowup_over_png);
|
||||||
|
arrowUpOverImg = new GuiImage(arrowUpOver);
|
||||||
|
scrollbarBox = new GuiImageData(scrollbar_box_png);
|
||||||
|
scrollbarBoxImg = new GuiImage(scrollbarBox);
|
||||||
|
scrollbarBoxOver = new GuiImageData(scrollbar_box_over_png);
|
||||||
|
scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver);
|
||||||
|
|
||||||
|
arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());
|
||||||
|
arrowUpBtn->SetParent(this);
|
||||||
|
arrowUpBtn->SetImage(arrowUpImg);
|
||||||
|
arrowUpBtn->SetImageOver(arrowUpOverImg);
|
||||||
|
arrowUpBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
arrowUpBtn->SetSelectable(false);
|
||||||
|
arrowUpBtn->SetTrigger(trigA);
|
||||||
|
|
||||||
|
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
|
||||||
|
arrowDownBtn->SetParent(this);
|
||||||
|
arrowDownBtn->SetImage(arrowDownImg);
|
||||||
|
arrowDownBtn->SetImageOver(arrowDownOverImg);
|
||||||
|
arrowDownBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||||
|
arrowDownBtn->SetSelectable(false);
|
||||||
|
arrowDownBtn->SetTrigger(trigA);
|
||||||
|
|
||||||
|
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
|
||||||
|
scrollbarBoxBtn->SetParent(this);
|
||||||
|
scrollbarBoxBtn->SetImage(scrollbarBoxImg);
|
||||||
|
scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg);
|
||||||
|
scrollbarBoxBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
|
scrollbarBoxBtn->SetSelectable(false);
|
||||||
|
|
||||||
|
for(int i=0; i<SAVELISTSIZE; i++)
|
||||||
|
{
|
||||||
|
saveDate[i] = new GuiText(NULL, 22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
saveDate[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
|
saveDate[i]->SetPosition(80,5);
|
||||||
|
saveTime[i] = new GuiText(NULL, 22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
saveTime[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
|
saveTime[i]->SetPosition(80,27);
|
||||||
|
|
||||||
|
saveType[i] = new GuiText(NULL, 22, (GXColor){0, 0, 0, 0xff});
|
||||||
|
saveType[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
|
saveType[i]->SetPosition(80,50);
|
||||||
|
|
||||||
|
saveBgImg[i] = new GuiImage(gameSave);
|
||||||
|
saveBgOverImg[i] = new GuiImage(gameSaveOver);
|
||||||
|
savePreviewImg[i] = new GuiImage(gameSaveBlank);
|
||||||
|
savePreviewImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
|
savePreviewImg[i]->SetPosition(5,0);
|
||||||
|
|
||||||
|
saveBtn[i] = new GuiButton(saveBgImg[i]->GetWidth(),saveBgImg[i]->GetHeight());
|
||||||
|
saveBtn[i]->SetParent(this);
|
||||||
|
saveBtn[i]->SetLabel(saveDate[i], 0);
|
||||||
|
saveBtn[i]->SetLabel(saveTime[i], 1);
|
||||||
|
saveBtn[i]->SetLabel(saveType[i], 2);
|
||||||
|
saveBtn[i]->SetImage(saveBgImg[i]);
|
||||||
|
saveBtn[i]->SetImageOver(saveBgOverImg[i]);
|
||||||
|
saveBtn[i]->SetIcon(savePreviewImg[i]);
|
||||||
|
saveBtn[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
|
saveBtn[i]->SetPosition(247*(i % 2),87*(i/2));
|
||||||
|
saveBtn[i]->SetTrigger(trigA);
|
||||||
|
saveBtn[i]->SetState(STATE_DISABLED);
|
||||||
|
saveBtn[i]->SetEffectGrow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiSaveBrowser class.
|
||||||
|
*/
|
||||||
|
GuiSaveBrowser::~GuiSaveBrowser()
|
||||||
|
{
|
||||||
|
delete arrowUpBtn;
|
||||||
|
delete arrowDownBtn;
|
||||||
|
delete scrollbarBoxBtn;
|
||||||
|
|
||||||
|
delete scrollbarImg;
|
||||||
|
delete arrowDownImg;
|
||||||
|
delete arrowDownOverImg;
|
||||||
|
delete arrowUpImg;
|
||||||
|
delete arrowUpOverImg;
|
||||||
|
delete scrollbarBoxImg;
|
||||||
|
delete scrollbarBoxOverImg;
|
||||||
|
|
||||||
|
delete gameSave;
|
||||||
|
delete gameSaveOver;
|
||||||
|
delete gameSaveBlank;
|
||||||
|
delete scrollbar;
|
||||||
|
delete arrowDown;
|
||||||
|
delete arrowDownOver;
|
||||||
|
delete arrowUp;
|
||||||
|
delete arrowUpOver;
|
||||||
|
delete scrollbarBox;
|
||||||
|
delete scrollbarBoxOver;
|
||||||
|
|
||||||
|
delete trigA;
|
||||||
|
|
||||||
|
for(int i=0; i<SAVELISTSIZE; i++)
|
||||||
|
{
|
||||||
|
delete saveBtn[i];
|
||||||
|
delete saveDate[i];
|
||||||
|
delete saveTime[i];
|
||||||
|
delete saveType[i];
|
||||||
|
delete saveBgImg[i];
|
||||||
|
delete saveBgOverImg[i];
|
||||||
|
delete savePreviewImg[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiSaveBrowser::SetFocus(int f)
|
||||||
|
{
|
||||||
|
focus = f;
|
||||||
|
|
||||||
|
for(int i=0; i<SAVELISTSIZE; i++)
|
||||||
|
saveBtn[i]->ResetState();
|
||||||
|
|
||||||
|
if(f == 1)
|
||||||
|
saveBtn[selectedItem]->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiSaveBrowser::ResetState()
|
||||||
|
{
|
||||||
|
if(state != STATE_DISABLED)
|
||||||
|
state = STATE_DEFAULT;
|
||||||
|
|
||||||
|
for(int i=0; i<SAVELISTSIZE; i++)
|
||||||
|
{
|
||||||
|
saveBtn[i]->ResetState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiSaveBrowser::GetClickedSave()
|
||||||
|
{
|
||||||
|
int found = -1;
|
||||||
|
for(int i=0; i<SAVELISTSIZE; i++)
|
||||||
|
{
|
||||||
|
if(saveBtn[i]->GetState() == STATE_CLICKED)
|
||||||
|
{
|
||||||
|
saveBtn[i]->SetState(STATE_SELECTED);
|
||||||
|
found = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the button on screen
|
||||||
|
*/
|
||||||
|
void GuiSaveBrowser::Draw()
|
||||||
|
{
|
||||||
|
if(!this->IsVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(int i=0; i<SAVELISTSIZE; i++)
|
||||||
|
saveBtn[i]->Draw();
|
||||||
|
|
||||||
|
scrollbarImg->Draw();
|
||||||
|
arrowUpBtn->Draw();
|
||||||
|
arrowDownBtn->Draw();
|
||||||
|
scrollbarBoxBtn->Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiSaveBrowser::Update(GuiTrigger * t)
|
||||||
|
{
|
||||||
|
int i, len;
|
||||||
|
char savetext[50];
|
||||||
|
// update the location of the scroll box based on the position in the option list
|
||||||
|
int position = 136*(selectedItem) / saves->length;
|
||||||
|
scrollbarBoxBtn->SetPosition(0,position+36);
|
||||||
|
|
||||||
|
arrowUpBtn->Update(t);
|
||||||
|
arrowDownBtn->Update(t);
|
||||||
|
scrollbarBoxBtn->Update(t);
|
||||||
|
|
||||||
|
// pad/joystick navigation
|
||||||
|
if(!focus)
|
||||||
|
goto endNavigation; // skip navigation
|
||||||
|
|
||||||
|
if(t->Right())
|
||||||
|
{
|
||||||
|
if(selectedItem == SAVELISTSIZE-1)
|
||||||
|
{
|
||||||
|
if(listOffset + SAVELISTSIZE < saves->length)
|
||||||
|
{
|
||||||
|
// move list down by 1 row
|
||||||
|
listOffset += 2;
|
||||||
|
selectedItem -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(saveBtn[selectedItem+1]->IsVisible())
|
||||||
|
{
|
||||||
|
saveBtn[selectedItem]->ResetState();
|
||||||
|
saveBtn[selectedItem+1]->SetState(STATE_SELECTED);
|
||||||
|
selectedItem += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(t->Left())
|
||||||
|
{
|
||||||
|
if(selectedItem == 0)
|
||||||
|
{
|
||||||
|
if((listOffset - 2 >= 0 && action == 0) ||
|
||||||
|
(listOffset - 2 >= -2 && action == 1))
|
||||||
|
{
|
||||||
|
// move list up by 1
|
||||||
|
listOffset -= 2;
|
||||||
|
selectedItem = SAVELISTSIZE-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selectedItem -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(t->Down())
|
||||||
|
{
|
||||||
|
if(selectedItem >= SAVELISTSIZE-2)
|
||||||
|
{
|
||||||
|
if(listOffset + SAVELISTSIZE + 1 < saves->length)
|
||||||
|
{
|
||||||
|
listOffset += 2;
|
||||||
|
}
|
||||||
|
else if(listOffset + SAVELISTSIZE < saves->length)
|
||||||
|
{
|
||||||
|
listOffset += 2;
|
||||||
|
|
||||||
|
if(selectedItem == SAVELISTSIZE-1)
|
||||||
|
selectedItem -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(saveBtn[selectedItem+2]->IsVisible())
|
||||||
|
{
|
||||||
|
selectedItem += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(t->Up())
|
||||||
|
{
|
||||||
|
if(selectedItem < 2)
|
||||||
|
{
|
||||||
|
if((listOffset - 2 >= 0 && action == 0) ||
|
||||||
|
(listOffset - 2 >= -2 && action == 1))
|
||||||
|
{
|
||||||
|
// move list up by 1
|
||||||
|
listOffset -= 2;
|
||||||
|
|
||||||
|
if(selectedItem == 0)
|
||||||
|
selectedItem = SAVELISTSIZE-2;
|
||||||
|
else
|
||||||
|
selectedItem = SAVELISTSIZE-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selectedItem -= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
endNavigation:
|
||||||
|
|
||||||
|
for(i=0; i<SAVELISTSIZE; i++)
|
||||||
|
{
|
||||||
|
if(listOffset+i < 0 && action == 1)
|
||||||
|
{
|
||||||
|
saveDate[0]->SetText(NULL);
|
||||||
|
saveDate[1]->SetText(NULL);
|
||||||
|
saveTime[0]->SetText("New SRAM");
|
||||||
|
saveTime[1]->SetText("New Snapshot");
|
||||||
|
saveType[0]->SetText(NULL);
|
||||||
|
saveType[1]->SetText(NULL);
|
||||||
|
savePreviewImg[0]->SetImage(gameSaveBlank);
|
||||||
|
savePreviewImg[1]->SetImage(gameSaveBlank);
|
||||||
|
savePreviewImg[0]->SetScale(1);
|
||||||
|
savePreviewImg[1]->SetScale(1);
|
||||||
|
saveBtn[0]->SetVisible(true);
|
||||||
|
saveBtn[1]->SetVisible(true);
|
||||||
|
|
||||||
|
if(saveBtn[0]->GetState() == STATE_DISABLED)
|
||||||
|
saveBtn[0]->SetState(STATE_DEFAULT);
|
||||||
|
if(saveBtn[1]->GetState() == STATE_DISABLED)
|
||||||
|
saveBtn[1]->SetState(STATE_DEFAULT);
|
||||||
|
}
|
||||||
|
else if(listOffset+i < saves->length)
|
||||||
|
{
|
||||||
|
if(saveBtn[i]->GetState() == STATE_DISABLED)
|
||||||
|
{
|
||||||
|
saveBtn[i]->SetVisible(true);
|
||||||
|
saveBtn[i]->SetState(STATE_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
saveDate[i]->SetText(saves->date[listOffset+i]);
|
||||||
|
saveTime[i]->SetText(saves->time[listOffset+i]);
|
||||||
|
|
||||||
|
if(saves->type[listOffset+i] == FILE_SRAM)
|
||||||
|
sprintf(savetext, "SRAM");
|
||||||
|
else
|
||||||
|
sprintf(savetext, "Snapshot");
|
||||||
|
|
||||||
|
len = strlen(saves->filename[listOffset+i]);
|
||||||
|
if(len > 10 &&
|
||||||
|
saves->filename[listOffset+i][len-8] == 'A' &&
|
||||||
|
saves->filename[listOffset+i][len-7] == 'u' &&
|
||||||
|
saves->filename[listOffset+i][len-6] == 't' &&
|
||||||
|
saves->filename[listOffset+i][len-5] == 'o'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
strcat(savetext, " (Auto)");
|
||||||
|
}
|
||||||
|
saveType[i]->SetText(savetext);
|
||||||
|
|
||||||
|
if(saves->previewImg[listOffset+i] != NULL)
|
||||||
|
{
|
||||||
|
savePreviewImg[i]->SetImage(saves->previewImg[listOffset+i]);
|
||||||
|
savePreviewImg[i]->SetScale(0.1);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
savePreviewImg[i]->SetImage(gameSaveBlank);
|
||||||
|
savePreviewImg[i]->SetScale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
saveBtn[i]->SetVisible(false);
|
||||||
|
saveBtn[i]->SetState(STATE_DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(focus)
|
||||||
|
{
|
||||||
|
if(i != selectedItem && saveBtn[i]->GetState() == STATE_SELECTED)
|
||||||
|
saveBtn[i]->ResetState();
|
||||||
|
else if(i == selectedItem && saveBtn[i]->GetState() == STATE_DEFAULT)
|
||||||
|
saveBtn[selectedItem]->SetState(STATE_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
saveBtn[i]->Update(t);
|
||||||
|
|
||||||
|
if(saveBtn[i]->GetState() == STATE_SELECTED)
|
||||||
|
selectedItem = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(updateCB)
|
||||||
|
updateCB(this);
|
||||||
|
}
|
134
source/ngc/gui/gui_sound.cpp
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_sound.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the GuiSound class.
|
||||||
|
*/
|
||||||
|
GuiSound::GuiSound(const u8 * snd, s32 len, int t)
|
||||||
|
{
|
||||||
|
sound = snd;
|
||||||
|
length = len;
|
||||||
|
type = t;
|
||||||
|
voice = -1;
|
||||||
|
volume = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiSound class.
|
||||||
|
*/
|
||||||
|
GuiSound::~GuiSound()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiSound::Play()
|
||||||
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
|
int vol;
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case SOUND_PCM:
|
||||||
|
vol = 255*(volume/100.0)*(GCSettings.SFXVolume/100.0);
|
||||||
|
voice = ASND_GetFirstUnusedVoice();
|
||||||
|
if(voice >= 0)
|
||||||
|
ASND_SetVoice(voice, VOICE_MONO_8BIT, 8000, 0,
|
||||||
|
(u8 *)sound, length, vol, vol, NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_OGG:
|
||||||
|
voice = 0;
|
||||||
|
PlayOgg(mem_open((char *)sound, length), 0, OGG_INFINITE_TIME);
|
||||||
|
SetVolumeOgg(255*(volume/100.0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiSound::Stop()
|
||||||
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
|
if(voice < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case SOUND_PCM:
|
||||||
|
ASND_StopVoice(voice);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_OGG:
|
||||||
|
StopOgg();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiSound::Pause()
|
||||||
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
|
if(voice < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case SOUND_PCM:
|
||||||
|
ASND_PauseVoice(voice, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_OGG:
|
||||||
|
PauseOgg(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiSound::Resume()
|
||||||
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
|
if(voice < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case SOUND_PCM:
|
||||||
|
ASND_PauseVoice(voice, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_OGG:
|
||||||
|
PauseOgg(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiSound::SetVolume(int vol)
|
||||||
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
|
volume = vol;
|
||||||
|
|
||||||
|
if(voice < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int newvol = 255*(volume/100.0)*(GCSettings.SFXVolume/100.0);
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case SOUND_PCM:
|
||||||
|
ASND_ChangeVolumeVoice(voice, newvol, newvol);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_OGG:
|
||||||
|
SetVolumeOgg(255*(volume/100.0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
148
source/ngc/gui/gui_text.cpp
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_text.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
#include "snes9xGX.h"
|
||||||
|
#include "filelist.h"
|
||||||
|
|
||||||
|
static int currentSize = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the GuiText class.
|
||||||
|
*/
|
||||||
|
GuiText::GuiText(const char * t, int s, GXColor c)
|
||||||
|
{
|
||||||
|
text = NULL;
|
||||||
|
size = s;
|
||||||
|
color = c;
|
||||||
|
alpha = c.a;
|
||||||
|
style = FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE;
|
||||||
|
|
||||||
|
alignmentHor = ALIGN_CENTRE;
|
||||||
|
alignmentVert = ALIGN_MIDDLE;
|
||||||
|
|
||||||
|
if(t)
|
||||||
|
{
|
||||||
|
// this is temporary: removes - and '
|
||||||
|
// because FreeType GX won't show them
|
||||||
|
char newt[200];
|
||||||
|
int i = -1;
|
||||||
|
strcpy(newt, t);
|
||||||
|
while(newt[++i] != 0)
|
||||||
|
if(newt[i] == '-' || newt[i] == '\'')
|
||||||
|
newt[i] = ' ';
|
||||||
|
|
||||||
|
text = fontSystem->charToWideChar((char *)newt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiText class.
|
||||||
|
*/
|
||||||
|
GuiText::~GuiText()
|
||||||
|
{
|
||||||
|
if(text)
|
||||||
|
{
|
||||||
|
delete text;
|
||||||
|
text = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiText::SetText(const char * t)
|
||||||
|
{
|
||||||
|
if(text)
|
||||||
|
delete text;
|
||||||
|
|
||||||
|
text = NULL;
|
||||||
|
|
||||||
|
if(t)
|
||||||
|
{
|
||||||
|
// this is temporary: removes - and '
|
||||||
|
// because FreeType GX won't show them
|
||||||
|
char newt[200];
|
||||||
|
int i = -1;
|
||||||
|
strcpy(newt, t);
|
||||||
|
while(newt[++i] != 0)
|
||||||
|
if(newt[i] == '-' || newt[i] == '\'')
|
||||||
|
newt[i] = ' ';
|
||||||
|
|
||||||
|
text = fontSystem->charToWideChar((char *)newt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void GuiText::SetSize(int s)
|
||||||
|
{
|
||||||
|
size = s;
|
||||||
|
}
|
||||||
|
void GuiText::SetColor(GXColor c)
|
||||||
|
{
|
||||||
|
color = c;
|
||||||
|
alpha = c.a;
|
||||||
|
}
|
||||||
|
void GuiText::SetStyle(u16 s)
|
||||||
|
{
|
||||||
|
style = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiText::SetAlignment(int hor, int vert)
|
||||||
|
{
|
||||||
|
style = 0;
|
||||||
|
|
||||||
|
switch(hor)
|
||||||
|
{
|
||||||
|
case ALIGN_LEFT:
|
||||||
|
style |= FTGX_JUSTIFY_LEFT;
|
||||||
|
break;
|
||||||
|
case ALIGN_RIGHT:
|
||||||
|
style |= FTGX_JUSTIFY_RIGHT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
style |= FTGX_JUSTIFY_CENTER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch(vert)
|
||||||
|
{
|
||||||
|
case ALIGN_TOP:
|
||||||
|
style |= FTGX_ALIGN_TOP;
|
||||||
|
break;
|
||||||
|
case ALIGN_BOTTOM:
|
||||||
|
style |= FTGX_ALIGN_BOTTOM;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
style |= FTGX_ALIGN_MIDDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
alignmentHor = hor;
|
||||||
|
alignmentVert = vert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the text on screen
|
||||||
|
*/
|
||||||
|
void GuiText::Draw()
|
||||||
|
{
|
||||||
|
if(!text)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!this->IsVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
GXColor c = color;
|
||||||
|
c.a = this->GetAlpha();
|
||||||
|
|
||||||
|
if(size != currentSize)
|
||||||
|
{
|
||||||
|
fontSystem->loadFont(font_ttf, font_ttf_size, size);
|
||||||
|
currentSize = size;
|
||||||
|
}
|
||||||
|
fontSystem->drawText((u16)this->GetLeft(), (u16)this->GetTop(), text, c, style);
|
||||||
|
|
||||||
|
this->UpdateEffects();
|
||||||
|
}
|
238
source/ngc/gui/gui_trigger.cpp
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_trigger.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
|
||||||
|
static int scrollDelay = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the GuiTrigger class.
|
||||||
|
*/
|
||||||
|
GuiTrigger::GuiTrigger()
|
||||||
|
{
|
||||||
|
chan = -1;
|
||||||
|
memset(&wpad, 0, sizeof(WPADData));
|
||||||
|
memset(&pad, 0, sizeof(PADData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor for the GuiTrigger class.
|
||||||
|
*/
|
||||||
|
GuiTrigger::~GuiTrigger()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a simple trigger. Requires:
|
||||||
|
* - Element is selected
|
||||||
|
* - Trigger button is pressed
|
||||||
|
*/
|
||||||
|
void GuiTrigger::SetSimpleTrigger(s32 ch, u32 wiibtns, u16 gcbtns)
|
||||||
|
{
|
||||||
|
type = TRIGGER_SIMPLE;
|
||||||
|
chan = ch;
|
||||||
|
wpad.btns_d = wiibtns;
|
||||||
|
pad.btns_d = gcbtns;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a button trigger. Requires:
|
||||||
|
* - Trigger button is pressed
|
||||||
|
*/
|
||||||
|
void GuiTrigger::SetButtonOnlyTrigger(s32 ch, u32 wiibtns, u16 gcbtns)
|
||||||
|
{
|
||||||
|
type = TRIGGER_BUTTON_ONLY;
|
||||||
|
chan = ch;
|
||||||
|
wpad.btns_d = wiibtns;
|
||||||
|
pad.btns_d = gcbtns;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a button trigger. Requires:
|
||||||
|
* - Trigger button is pressed
|
||||||
|
* - Parent window is in focus
|
||||||
|
*/
|
||||||
|
void GuiTrigger::SetButtonOnlyInFocusTrigger(s32 ch, u32 wiibtns, u16 gcbtns)
|
||||||
|
{
|
||||||
|
type = TRIGGER_BUTTON_ONLY_IN_FOCUS;
|
||||||
|
chan = ch;
|
||||||
|
wpad.btns_d = wiibtns;
|
||||||
|
pad.btns_d = gcbtns;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* WPAD_Stick
|
||||||
|
*
|
||||||
|
* Get X/Y value from Wii Joystick (classic, nunchuk) input
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
s8 GuiTrigger::WPAD_Stick(u8 right, int axis)
|
||||||
|
{
|
||||||
|
#ifdef HW_RVL
|
||||||
|
|
||||||
|
float mag = 0.0;
|
||||||
|
float ang = 0.0;
|
||||||
|
|
||||||
|
switch (wpad.exp.type)
|
||||||
|
{
|
||||||
|
case WPAD_EXP_NUNCHUK:
|
||||||
|
case WPAD_EXP_GUITARHERO3:
|
||||||
|
if (right == 0)
|
||||||
|
{
|
||||||
|
mag = wpad.exp.nunchuk.js.mag;
|
||||||
|
ang = wpad.exp.nunchuk.js.ang;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WPAD_EXP_CLASSIC:
|
||||||
|
if (right == 0)
|
||||||
|
{
|
||||||
|
mag = wpad.exp.classic.ljs.mag;
|
||||||
|
ang = wpad.exp.classic.ljs.ang;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mag = wpad.exp.classic.rjs.mag;
|
||||||
|
ang = wpad.exp.classic.rjs.ang;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate x/y value (angle need to be converted into radian) */
|
||||||
|
if (mag > 1.0) mag = 1.0;
|
||||||
|
else if (mag < -1.0) mag = -1.0;
|
||||||
|
double val;
|
||||||
|
|
||||||
|
if(axis == 0) // x-axis
|
||||||
|
val = mag * sin((PI * ang)/180.0f);
|
||||||
|
else // y-axis
|
||||||
|
val = mag * cos((PI * ang)/180.0f);
|
||||||
|
|
||||||
|
return (s8)(val * 128.0f);
|
||||||
|
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GuiTrigger::Left()
|
||||||
|
{
|
||||||
|
u32 wiibtn = GCSettings.WiimoteOrientation ? WPAD_BUTTON_UP : WPAD_BUTTON_LEFT;
|
||||||
|
|
||||||
|
if((wpad.btns_d | wpad.btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_LEFT)
|
||||||
|
|| (pad.btns_d | pad.btns_h) & PAD_BUTTON_LEFT
|
||||||
|
|| pad.stickX < -PADCAL
|
||||||
|
|| WPAD_Stick(0,0) < -PADCAL)
|
||||||
|
{
|
||||||
|
if(wpad.btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_LEFT)
|
||||||
|
|| pad.btns_d & PAD_BUTTON_LEFT)
|
||||||
|
{
|
||||||
|
scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(scrollDelay == 0)
|
||||||
|
{
|
||||||
|
scrollDelay = SCROLL_LOOP_DELAY;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scrollDelay--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GuiTrigger::Right()
|
||||||
|
{
|
||||||
|
u32 wiibtn = GCSettings.WiimoteOrientation ? WPAD_BUTTON_DOWN : WPAD_BUTTON_RIGHT;
|
||||||
|
|
||||||
|
if((wpad.btns_d | wpad.btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_RIGHT)
|
||||||
|
|| (pad.btns_d | pad.btns_h) & PAD_BUTTON_RIGHT
|
||||||
|
|| pad.stickX > PADCAL
|
||||||
|
|| WPAD_Stick(0,0) > PADCAL)
|
||||||
|
{
|
||||||
|
if(wpad.btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_RIGHT)
|
||||||
|
|| pad.btns_d & PAD_BUTTON_RIGHT)
|
||||||
|
{
|
||||||
|
scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(scrollDelay == 0)
|
||||||
|
{
|
||||||
|
scrollDelay = SCROLL_LOOP_DELAY;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scrollDelay--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GuiTrigger::Up()
|
||||||
|
{
|
||||||
|
u32 wiibtn = GCSettings.WiimoteOrientation ? WPAD_BUTTON_RIGHT : WPAD_BUTTON_UP;
|
||||||
|
|
||||||
|
if((wpad.btns_d | wpad.btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_UP)
|
||||||
|
|| (pad.btns_d | pad.btns_h) & PAD_BUTTON_UP
|
||||||
|
|| pad.stickY > PADCAL
|
||||||
|
|| WPAD_Stick(0,1) > PADCAL)
|
||||||
|
{
|
||||||
|
if(wpad.btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_UP)
|
||||||
|
|| pad.btns_d & PAD_BUTTON_UP)
|
||||||
|
{
|
||||||
|
scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(scrollDelay == 0)
|
||||||
|
{
|
||||||
|
scrollDelay = SCROLL_LOOP_DELAY;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scrollDelay--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GuiTrigger::Down()
|
||||||
|
{
|
||||||
|
u32 wiibtn = GCSettings.WiimoteOrientation ? WPAD_BUTTON_LEFT : WPAD_BUTTON_DOWN;
|
||||||
|
|
||||||
|
if((wpad.btns_d | wpad.btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_DOWN)
|
||||||
|
|| (pad.btns_d | pad.btns_h) & PAD_BUTTON_DOWN
|
||||||
|
|| pad.stickY < -PADCAL
|
||||||
|
|| WPAD_Stick(0,1) < -PADCAL)
|
||||||
|
{
|
||||||
|
if(wpad.btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_DOWN)
|
||||||
|
|| pad.btns_d & PAD_BUTTON_DOWN)
|
||||||
|
{
|
||||||
|
scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(scrollDelay == 0)
|
||||||
|
{
|
||||||
|
scrollDelay = SCROLL_LOOP_DELAY;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scrollDelay--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
393
source/ngc/gui/gui_window.cpp
Normal file
@ -0,0 +1,393 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric February 2009
|
||||||
|
*
|
||||||
|
* gui_window.cpp
|
||||||
|
*
|
||||||
|
* GUI class definitions
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
|
||||||
|
GuiWindow::GuiWindow()
|
||||||
|
{
|
||||||
|
width = 0;
|
||||||
|
height = 0;
|
||||||
|
focus = 0; // allow focus
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiWindow::GuiWindow(int w, int h)
|
||||||
|
{
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
focus = 0; // allow focus
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiWindow::~GuiWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::Append(GuiElement* e)
|
||||||
|
{
|
||||||
|
if (e == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Remove(e);
|
||||||
|
_elements.push_back(e);
|
||||||
|
e->SetParent(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::Insert(GuiElement* e, u32 index)
|
||||||
|
{
|
||||||
|
if (e == NULL || index > (_elements.size() - 1))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Remove(e);
|
||||||
|
_elements.insert(_elements.begin()+index, e);
|
||||||
|
e->SetParent(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::Remove(GuiElement* e)
|
||||||
|
{
|
||||||
|
if (e == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (u8 i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
if(e == _elements.at(i))
|
||||||
|
{
|
||||||
|
_elements.erase(_elements.begin()+i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::RemoveAll()
|
||||||
|
{
|
||||||
|
_elements.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiElement* GuiWindow::GetGuiElementAt(u32 index) const
|
||||||
|
{
|
||||||
|
if (index >= _elements.size())
|
||||||
|
return NULL;
|
||||||
|
return _elements.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 GuiWindow::GetSize()
|
||||||
|
{
|
||||||
|
return _elements.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::Draw()
|
||||||
|
{
|
||||||
|
if(_elements.size() == 0 || !this->IsVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (u8 i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try { _elements.at(i)->Draw(); }
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
this->UpdateEffects();
|
||||||
|
|
||||||
|
if(parentElement && state == STATE_DISABLED)
|
||||||
|
Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0xbe, 0xca, 0xd5, 0x70},1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::ResetState()
|
||||||
|
{
|
||||||
|
if(state != STATE_DISABLED)
|
||||||
|
state = STATE_DEFAULT;
|
||||||
|
|
||||||
|
for (u8 i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try { _elements.at(i)->ResetState(); }
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::SetState(int s)
|
||||||
|
{
|
||||||
|
state = s;
|
||||||
|
|
||||||
|
for (u8 i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try { _elements.at(i)->SetState(s); }
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::SetFocus(int f)
|
||||||
|
{
|
||||||
|
focus = f;
|
||||||
|
|
||||||
|
if(f == 1)
|
||||||
|
this->MoveSelectionVert(1);
|
||||||
|
else
|
||||||
|
this->ResetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::ChangeFocus(GuiElement* e)
|
||||||
|
{
|
||||||
|
if(parentElement)
|
||||||
|
return; // this is only intended for the main window
|
||||||
|
|
||||||
|
for (u8 i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
if(e == _elements.at(i))
|
||||||
|
_elements.at(i)->SetFocus(1);
|
||||||
|
else if(_elements.at(i)->IsFocused() == 1)
|
||||||
|
_elements.at(i)->SetFocus(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::ToggleFocus(GuiTrigger * t)
|
||||||
|
{
|
||||||
|
if(parentElement)
|
||||||
|
return; // this is only intended for the main window
|
||||||
|
|
||||||
|
int found = -1;
|
||||||
|
int newfocus = -1;
|
||||||
|
u8 i;
|
||||||
|
|
||||||
|
// look for currently in focus element
|
||||||
|
for (i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->IsFocused() == 1)
|
||||||
|
{
|
||||||
|
found = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
// element with focus not found, try to give focus
|
||||||
|
if(found == -1)
|
||||||
|
{
|
||||||
|
for (i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->IsFocused() == 0 && _elements.at(i)->GetState() != STATE_DISABLED) // focus is possible (but not set)
|
||||||
|
{
|
||||||
|
_elements.at(i)->SetFocus(1); // give this element focus
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// change focus
|
||||||
|
else if(t->wpad.btns_d & (WPAD_BUTTON_1 | WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B)
|
||||||
|
|| t->pad.btns_d & PAD_BUTTON_B)
|
||||||
|
{
|
||||||
|
for (i = found; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->IsFocused() == 0 && _elements.at(i)->GetState() != STATE_DISABLED) // focus is possible (but not set)
|
||||||
|
{
|
||||||
|
newfocus = i;
|
||||||
|
_elements.at(i)->SetFocus(1); // give this element focus
|
||||||
|
_elements.at(found)->SetFocus(0); // disable focus on other element
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
if(newfocus == -1)
|
||||||
|
{
|
||||||
|
for (i = 0; i < found; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->IsFocused() == 0 && _elements.at(i)->GetState() != STATE_DISABLED) // focus is possible (but not set)
|
||||||
|
{
|
||||||
|
_elements.at(i)->SetFocus(1); // give this element focus
|
||||||
|
_elements.at(found)->SetFocus(0); // disable focus on other element
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiWindow::GetSelected()
|
||||||
|
{
|
||||||
|
// find selected element
|
||||||
|
int found = -1;
|
||||||
|
for (u8 i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->GetState() == STATE_SELECTED)
|
||||||
|
{
|
||||||
|
found = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set element to left/right as selected
|
||||||
|
// there's probably a more clever way to do this, but this way works
|
||||||
|
void GuiWindow::MoveSelectionHor(int dir)
|
||||||
|
{
|
||||||
|
int found = -1;
|
||||||
|
u16 left = 0;
|
||||||
|
u16 top = 0;
|
||||||
|
u8 i = 0;
|
||||||
|
|
||||||
|
int selected = this->GetSelected();
|
||||||
|
|
||||||
|
if(selected >= 0)
|
||||||
|
{
|
||||||
|
left = _elements.at(selected)->GetLeft();
|
||||||
|
top = _elements.at(selected)->GetTop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// look for a button on the same row, to the left/right
|
||||||
|
for (i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->IsSelectable())
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->GetLeft()*dir > left*dir && _elements.at(i)->GetTop() == top)
|
||||||
|
{
|
||||||
|
if(found == -1)
|
||||||
|
found = i;
|
||||||
|
else if(_elements.at(i)->GetLeft()*dir < _elements.at(found)->GetLeft()*dir)
|
||||||
|
found = i; // this is a better match
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
if(found >= 0)
|
||||||
|
goto matchfound;
|
||||||
|
|
||||||
|
// match still not found, let's try the first button in the next row
|
||||||
|
for (i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->IsSelectable())
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->GetTop()*dir > top*dir)
|
||||||
|
{
|
||||||
|
if(found == -1)
|
||||||
|
found = i;
|
||||||
|
else if(_elements.at(i)->GetTop()*dir < _elements.at(found)->GetTop()*dir)
|
||||||
|
found = i; // this is a better match
|
||||||
|
else if(_elements.at(i)->GetTop()*dir == _elements.at(found)->GetTop()*dir
|
||||||
|
&&
|
||||||
|
_elements.at(i)->GetLeft()*dir < _elements.at(found)->GetLeft()*dir)
|
||||||
|
found = i; // this is a better match
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
// match found
|
||||||
|
matchfound:
|
||||||
|
if(found >= 0)
|
||||||
|
{
|
||||||
|
_elements.at(found)->SetState(STATE_SELECTED);
|
||||||
|
if(selected >= 0)
|
||||||
|
_elements.at(selected)->ResetState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::MoveSelectionVert(int dir)
|
||||||
|
{
|
||||||
|
int found = -1;
|
||||||
|
u16 left = 0;
|
||||||
|
u16 top = 0;
|
||||||
|
u8 i = 0;
|
||||||
|
|
||||||
|
int selected = this->GetSelected();
|
||||||
|
|
||||||
|
if(selected >= 0)
|
||||||
|
{
|
||||||
|
left = _elements.at(selected)->GetLeft();
|
||||||
|
top = _elements.at(selected)->GetTop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// look for a button above/below, with the least horizontal difference
|
||||||
|
for (i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->IsSelectable())
|
||||||
|
{
|
||||||
|
if(_elements.at(i)->GetTop()*dir > top*dir)
|
||||||
|
{
|
||||||
|
if(found == -1)
|
||||||
|
found = i;
|
||||||
|
else if(_elements.at(i)->GetTop()*dir < _elements.at(found)->GetTop()*dir)
|
||||||
|
found = i; // this is a better match
|
||||||
|
else if(_elements.at(i)->GetTop()*dir == _elements.at(found)->GetTop()*dir
|
||||||
|
&&
|
||||||
|
abs(_elements.at(i)->GetLeft() - left) <
|
||||||
|
abs(_elements.at(found)->GetLeft() - left))
|
||||||
|
found = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
if(found >= 0)
|
||||||
|
goto matchfound;
|
||||||
|
|
||||||
|
// match found
|
||||||
|
matchfound:
|
||||||
|
if(found >= 0)
|
||||||
|
{
|
||||||
|
_elements.at(found)->SetState(STATE_SELECTED);
|
||||||
|
if(selected >= 0)
|
||||||
|
_elements.at(selected)->ResetState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiWindow::Update(GuiTrigger * t)
|
||||||
|
{
|
||||||
|
if(_elements.size() == 0 || (state == STATE_DISABLED && parentElement))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (u8 i = 0; i < _elements.size(); i++)
|
||||||
|
{
|
||||||
|
try { _elements.at(i)->Update(t); }
|
||||||
|
catch (exception& e) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
this->ToggleFocus(t);
|
||||||
|
|
||||||
|
if(focus) // only send actions to this window if it's in focus
|
||||||
|
{
|
||||||
|
// pad/joystick navigation
|
||||||
|
if(t->Right())
|
||||||
|
this->MoveSelectionHor(1);
|
||||||
|
else if(t->Left())
|
||||||
|
this->MoveSelectionHor(-1);
|
||||||
|
else if(t->Down())
|
||||||
|
this->MoveSelectionVert(1);
|
||||||
|
else if(t->Up())
|
||||||
|
this->MoveSelectionVert(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(updateCB)
|
||||||
|
updateCB(this);
|
||||||
|
}
|
@ -22,7 +22,7 @@
|
|||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "menudraw.h"
|
#include "menu.h"
|
||||||
#include "http.h"
|
#include "http.h"
|
||||||
|
|
||||||
|
|
||||||
@ -417,6 +417,7 @@ bool http_request(const char *url, FILE * hfile, u8 * buffer,
|
|||||||
ShowProgress("Downloading...", (content_length - bytesLeft),
|
ShowProgress("Downloading...", (content_length - bytesLeft),
|
||||||
content_length);
|
content_length);
|
||||||
}
|
}
|
||||||
|
CancelAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!b || !res)
|
if (!b || !res)
|
||||||
|
BIN
source/ngc/images/battery.png
Normal file
After Width: | Height: | Size: 216 B |
BIN
source/ngc/images/battery_bar.png
Normal file
After Width: | Height: | Size: 145 B |
BIN
source/ngc/images/bg_bottom.png
Normal file
After Width: | Height: | Size: 838 B |
BIN
source/ngc/images/bg_game_selection.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
source/ngc/images/bg_game_selection_entry.png
Normal file
After Width: | Height: | Size: 279 B |
BIN
source/ngc/images/bg_options.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
source/ngc/images/bg_options_entry.png
Normal file
After Width: | Height: | Size: 299 B |
BIN
source/ngc/images/bg_top.png
Normal file
After Width: | Height: | Size: 771 B |
BIN
source/ngc/images/button.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
source/ngc/images/button_arrow_down.png
Normal file
After Width: | Height: | Size: 792 B |
BIN
source/ngc/images/button_arrow_down_over.png
Normal file
After Width: | Height: | Size: 764 B |
BIN
source/ngc/images/button_arrow_left.png
Normal file
After Width: | Height: | Size: 842 B |
BIN
source/ngc/images/button_arrow_left_over.png
Normal file
After Width: | Height: | Size: 776 B |
BIN
source/ngc/images/button_arrow_right.png
Normal file
After Width: | Height: | Size: 821 B |
BIN
source/ngc/images/button_arrow_right_over.png
Normal file
After Width: | Height: | Size: 775 B |
BIN
source/ngc/images/button_arrow_up.png
Normal file
After Width: | Height: | Size: 746 B |
BIN
source/ngc/images/button_arrow_up_over.png
Normal file
After Width: | Height: | Size: 710 B |
BIN
source/ngc/images/button_close.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
source/ngc/images/button_close_over.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
source/ngc/images/button_gamesave.png
Normal file
After Width: | Height: | Size: 546 B |
BIN
source/ngc/images/button_gamesave_blank.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
source/ngc/images/button_gamesave_over.png
Normal file
After Width: | Height: | Size: 539 B |
BIN
source/ngc/images/button_large.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
source/ngc/images/button_large_over.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
source/ngc/images/button_over.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
source/ngc/images/dialogue_box.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
source/ngc/images/folder.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
@ -1,696 +0,0 @@
|
|||||||
/*
|
|
||||||
* File : bg3.bmp
|
|
||||||
* Width : 640
|
|
||||||
* Height: 480
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _IMGBG_
|
|
||||||
#define _IMGBG_
|
|
||||||
|
|
||||||
#define BG_WIDTH (640)
|
|
||||||
#define BG_HEIGHT (480)
|
|
||||||
#define BG_RAW (614400)
|
|
||||||
#define BG_COMPRESSED (8789)
|
|
||||||
|
|
||||||
const unsigned char bg[]=
|
|
||||||
{
|
|
||||||
0x78,0x9c,0xed,0xdd,0x77,0xb0,0x94,0xf5,0xbd,0xf8,0x71,0x9d,0x4c,
|
|
||||||
0x26,0xe3,0x24,0x93,0xdc,0xeb,0xe4,0xc6,0x4b,0x20,0x89,0xf1,0xc6,
|
|
||||||
0x68,0x8c,0x28,0x18,0x31,0x51,0x2c,0x80,0xb1,0x05,0x84,0x83,0x68,
|
|
||||||
0xec,0x25,0x41,0x63,0x41,0x11,0xa4,0x6d,0x7b,0xbe,0xbb,0xdf,0xe7,
|
|
||||||
0xd9,0x3d,0x20,0x96,0x44,0xa3,0x46,0x13,0x1b,0x8a,0xd8,0x00,0xa5,
|
|
||||||
0x8a,0x8a,0x0a,0xa8,0x80,0x02,0x8a,0x8a,0x35,0xc4,0x82,0x68,0x40,
|
|
||||||
0x40,0x4a,0x72,0x6b,0xca,0xef,0xf7,0x9c,0x43,0x09,0xe6,0xf7,0xbb,
|
|
||||||
0xf7,0x9a,0x4a,0xf1,0xf5,0x9e,0x79,0xcd,0x39,0xbb,0xec,0xd9,0xf6,
|
|
||||||
0xc7,0x67,0xbe,0xdf,0xdd,0x67,0x97,0x5f,0x37,0x7e,0x5d,0xf8,0x35,
|
|
||||||
0x00,0x00,0x1f,0x1d,0xcd,0xbf,0x2e,0x02,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x6c,0x67,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0xfb,0x7e,
|
|
||||||
0xd5,0xf8,0xd5,0x16,0xb3,0xae,0xb1,0xaa,0xf0,0xcb,0xc6,0x92,0xe2,
|
|
||||||
0x92,0xc6,0xdb,0xc5,0xe5,0x8d,0xf7,0xb7,0xe8,0x7d,0x01,0xf8,0x7b,
|
|
||||||
0x59,0xd5,0x78,0xb3,0x38,0xbf,0x3e,0xb9,0x74,0x63,0x76,0x45,0x79,
|
|
||||||
0x64,0x76,0x75,0x79,0x74,0x36,0xbd,0xf4,0x52,0x7d,0x79,0x71,0xdd,
|
|
||||||
0x56,0x70,0xdf,0x00,0xfe,0x56,0xd6,0x35,0x96,0x16,0x66,0x65,0xd7,
|
|
||||||
0x96,0x2e,0x8a,0xbd,0x92,0x43,0x7e,0xdc,0xb1,0xdc,0xfe,0xa7,0xfb,
|
|
||||||
0x94,0x0e,0xac,0x9f,0x98,0xa4,0xd9,0xfd,0xe5,0x9f,0x37,0x56,0x6f,
|
|
||||||
0xf1,0xfb,0x07,0xf0,0xb7,0xf2,0x76,0x7d,0x72,0x71,0x50,0x76,0x68,
|
|
||||||
0xe5,0xa0,0x49,0x9d,0x86,0xb6,0x5f,0xb5,0x67,0xff,0xdd,0x7f,0xb5,
|
|
||||||
0xdb,0x85,0x5f,0x9c,0xf7,0xf9,0x41,0x7b,0x36,0x4e,0x4e,0x6e,0xcc,
|
|
||||||
0x16,0x95,0x56,0x6f,0x05,0xf7,0x11,0xe0,0xaf,0xef,0xbd,0xc2,0xc3,
|
|
||||||
0xd9,0x45,0xe5,0x4e,0xb7,0x1d,0x59,0xec,0xf4,0xef,0x5f,0xba,0xb0,
|
|
||||||
0xdd,0x6f,0xdb,0xf5,0x6b,0xfb,0x5f,0xed,0xfa,0xb5,0xfb,0xfd,0x97,
|
|
||||||
0xfa,0xb5,0x79,0xa8,0xcd,0xd0,0x5e,0xe9,0xcd,0x95,0xd7,0x1b,0xeb,
|
|
||||||
0xb6,0x82,0xfb,0x09,0xf0,0xd7,0xb5,0xae,0xfe,0x62,0x71,0x44,0x7a,
|
|
||||||
0x50,0xe5,0xd8,0x57,0xdb,0x0f,0x68,0xf7,0x5f,0x6d,0xf3,0xd9,0xd7,
|
|
||||||
0xf6,0xc2,0xb6,0xff,0xb9,0xde,0x17,0xd6,0xb6,0xb9,0xa8,0xdd,0x88,
|
|
||||||
0x73,0x2a,0x8f,0xd4,0x57,0x15,0xb7,0xf4,0xfd,0x04,0xf8,0x6b,0x5b,
|
|
||||||
0x59,0x9f,0x56,0x3c,0xf9,0xaa,0xae,0xe5,0x83,0x7f,0xdd,0xf6,0xa2,
|
|
||||||
0xd6,0xb9,0xb7,0xd9,0xfc,0x6b,0xfb,0xdb,0x2f,0xf4,0xfb,0xec,0xe8,
|
|
||||||
0x83,0x8a,0x3f,0xab,0x2f,0x29,0x6d,0xe9,0xfb,0x09,0xf0,0xd7,0xb6,
|
|
||||||
0xb4,0x7e,0x63,0xe9,0xb0,0x3b,0xba,0x17,0xbf,0xf4,0x9b,0x0d,0x6b,
|
|
||||||
0xbf,0xcd,0xe7,0x5f,0xbe,0x0f,0xfe,0xfc,0x63,0xbb,0x0e,0x2e,0x64,
|
|
||||||
0xcf,0x95,0xd7,0x5f,0x7e,0x5d,0x61,0x4d,0xe3,0xfd,0xc2,0x8a,0xc6,
|
|
||||||
0x8a,0xe2,0xaa,0xc6,0x9a,0x82,0xf7,0x86,0x81,0x6d,0xd9,0x1b,0xf5,
|
|
||||||
0x91,0xa5,0x83,0xa7,0x76,0x1b,0xda,0xee,0x37,0x1f,0xdc,0xfb,0x6e,
|
|
||||||
0xda,0x03,0x3f,0xff,0x4f,0x03,0x4f,0xcb,0x66,0x95,0xd7,0x34,0x56,
|
|
||||||
0x16,0x16,0xd7,0xe7,0x17,0x1f,0xab,0x4f,0x28,0xdd,0x99,0x8d,0x2e,
|
|
||||||
0x8f,0xab,0xcf,0x28,0xbd,0x50,0x7f,0xa7,0xb8,0x66,0x2b,0x78,0x0c,
|
|
||||||
0x00,0x7f,0x9a,0xf5,0xef,0x69,0x2c,0xce,0x1a,0xa5,0x6f,0x4d,0xef,
|
|
||||||
0x3c,0xa4,0xdd,0xef,0xbf,0xd0,0xaf,0xdd,0xef,0xdb,0xf5,0x6b,0x7d,
|
|
||||||
0x0d,0x70,0xb3,0xf9,0xd7,0xee,0xd5,0x9d,0x07,0x34,0x65,0x93,0xcb,
|
|
||||||
0xaf,0xd4,0x1f,0x28,0x8e,0x4c,0x7f,0x50,0x39,0xbe,0x76,0x54,0xe8,
|
|
||||||
0x56,0x39,0x74,0x44,0xd7,0xda,0x89,0xb5,0x52,0x3a,0xa6,0xfc,0x8c,
|
|
||||||
0x63,0x04,0x81,0x6d,0xce,0xba,0xd6,0xfd,0xeb,0xeb,0x59,0x5a,0x6a,
|
|
||||||
0xff,0xe8,0xc1,0x43,0x3e,0xff,0xde,0x3f,0xf5,0xff,0xec,0x6b,0xff,
|
|
||||||
0x3c,0xb0,0xdd,0xbf,0x7f,0xf1,0x03,0xeb,0xbf,0x76,0x2f,0xfe,0xe3,
|
|
||||||
0xc0,0xde,0xe9,0xa8,0xca,0x0d,0xe9,0x19,0x95,0x43,0x0a,0x3d,0xae,
|
|
||||||
0xed,0xdd,0xb7,0xcf,0xb3,0x27,0x9c,0xd2,0x67,0xd9,0x31,0x7d,0x0f,
|
|
||||||
0x7a,0x76,0x9f,0xa4,0xfb,0xa5,0x69,0xf6,0x48,0xf9,0xdd,0x2d,0xfe,
|
|
||||||
0x58,0x00,0xfe,0x14,0xeb,0xd7,0x7f,0x6f,0xd6,0x2f,0x2d,0xb5,0x1f,
|
|
||||||
0xf5,0xc5,0x62,0x9b,0x1f,0x75,0xac,0x1c,0x5e,0xef,0x9c,0xec,0x7e,
|
|
||||||
0xff,0x17,0x86,0xed,0xf6,0x9f,0xed,0xfa,0x6d,0x7a,0xfd,0x6f,0xf6,
|
|
||||||
0x3f,0x0d,0x3e,0x31,0x2d,0x57,0x7a,0x25,0x47,0x8d,0x38,0xef,0xb4,
|
|
||||||
0xd3,0x96,0xf4,0x3a,0xbe,0xc7,0xef,0x7b,0x1c,0xdf,0xe3,0xff,0xf4,
|
|
||||||
0xec,0xd3,0xf4,0xbb,0x9e,0xdf,0xef,0xb0,0xa8,0x53,0x1c,0x16,0x1e,
|
|
||||||
0xad,0x2f,0xf3,0xfe,0x30,0xf0,0x97,0x6b,0xfe,0x7b,0xc9,0xd7,0x7f,
|
|
||||||
0xf9,0xcf,0x5f,0x36,0xee,0x2b,0xf6,0x4b,0x7b,0x55,0xce,0xcf,0xae,
|
|
||||||
0x2f,0x4f,0xa8,0xdf,0x56,0x1e,0x96,0x1e,0x96,0xec,0xfe,0xc2,0x57,
|
|
||||||
0x07,0x6e,0x7c,0xff,0x77,0xe7,0x7b,0xf6,0x2c,0x9c,0x92,0x76,0x4f,
|
|
||||||
0xbe,0x73,0x41,0xff,0x87,0x7b,0x9e,0xf0,0x9d,0xdf,0x75,0x3f,0xbe,
|
|
||||||
0xc7,0x6f,0x7a,0xac,0xf7,0xdb,0x96,0x19,0xd8,0x71,0xf0,0xfe,0xb7,
|
|
||||||
0xa6,0xf5,0x05,0xa5,0x35,0x7f,0xb7,0xfb,0x0d,0xf0,0x97,0x59,0xd7,
|
|
||||||
0xbc,0x76,0xfd,0xcf,0xc6,0x5b,0x85,0xa7,0xea,0xd3,0x4b,0x73,0xeb,
|
|
||||||
0x4b,0x8a,0xab,0x9b,0xdf,0x2d,0xcc,0xc9,0x46,0x96,0x0e,0x19,0xdd,
|
|
||||||
0xa1,0xf8,0xe5,0xdf,0xb4,0xed,0xf7,0x85,0x7f,0xfb,0xe7,0x0b,0xff,
|
|
||||||
0xe9,0xb2,0xa3,0x2b,0x27,0x54,0x3b,0xc7,0x81,0xa7,0xf6,0x78,0x2f,
|
|
||||||
0x9f,0x7d,0xbf,0xdd,0x38,0xfb,0x5a,0x7f,0xf6,0xe9,0xf9,0xbb,0x5e,
|
|
||||||
0xdf,0xdf,0xfd,0xf9,0xa6,0x6c,0x7c,0x79,0xf9,0x56,0xf0,0x98,0x00,
|
|
||||||
0x3e,0x8c,0x96,0xb5,0xdf,0xda,0xe6,0x55,0x85,0x65,0x8d,0xa5,0x85,
|
|
||||||
0x25,0x8d,0x25,0xb9,0x77,0x0a,0xcb,0x9a,0x57,0x17,0xde,0x6b,0xcc,
|
|
||||||
0x2a,0x5e,0xf4,0xc3,0x6f,0x94,0x3b,0xfe,0xe7,0x17,0x2e,0xdc,0x65,
|
|
||||||
0xd6,0xce,0x83,0xbb,0xa5,0xe7,0x57,0x8e,0x28,0x9e,0x7c,0xed,0x29,
|
|
||||||
0xdf,0xed,0xfe,0x9f,0x1f,0x98,0x7d,0xeb,0x7f,0xfe,0xb6,0xe7,0xc9,
|
|
||||||
0x9d,0x57,0x75,0x88,0xd7,0x84,0xb7,0xfe,0xae,0x6b,0x57,0x80,0x3f,
|
|
||||||
0xd7,0xba,0xc2,0x3b,0x8d,0x17,0x8a,0xd3,0xeb,0x63,0x4a,0xd7,0x65,
|
|
||||||
0x8d,0x72,0x35,0x0b,0x95,0x90,0x35,0x2a,0xd7,0x66,0x77,0x95,0x1f,
|
|
||||||
0xad,0xcf,0x28,0xd5,0x47,0x7c,0xb3,0xb2,0xef,0xb3,0xff,0x78,0xc9,
|
|
||||||
0x17,0x46,0x74,0x4f,0xea,0x59,0xbd,0x72,0xf0,0x25,0x7d,0xc7,0x1c,
|
|
||||||
0x7b,0xfc,0xb1,0xbf,0xeb,0xf1,0x87,0xbd,0xef,0x26,0x3d,0x4f,0x38,
|
|
||||||
0xea,0x3f,0x76,0xaf,0x16,0x1b,0x2f,0x36,0xd6,0x6e,0x05,0x8f,0x0b,
|
|
||||||
0xe0,0x7f,0xf6,0x7e,0xe3,0xe9,0xe2,0x2d,0xd9,0xe0,0x72,0xaf,0xd8,
|
|
||||||
0x29,0xf9,0x56,0xd2,0xa9,0xb8,0x4f,0xb9,0x7d,0xae,0x63,0xe1,0x1b,
|
|
||||||
0xd5,0xfd,0x2b,0xbd,0xd2,0xfe,0x95,0xf3,0xeb,0x5d,0x2a,0x7b,0x0c,
|
|
||||||
0x3f,0x28,0x39,0x3f,0xbb,0xb5,0xfc,0x58,0xcb,0x7e,0xf8,0xa2,0x73,
|
|
||||||
0x26,0xe7,0x7b,0xdd,0xdf,0xf7,0xcc,0xf7,0xbb,0x3d,0xfb,0xac,0x5f,
|
|
||||||
0xf7,0xf5,0x38,0xfe,0xd8,0xd6,0x75,0x60,0x7e,0xfa,0x37,0x5f,0xa9,
|
|
||||||
0x5c,0x70,0xf9,0xb3,0x2d,0xdf,0x13,0xb3,0x15,0x3c,0x36,0x80,0xff,
|
|
||||||
0xde,0x7b,0x85,0x19,0x59,0xb1,0x7c,0x70,0xe8,0x5c,0x3e,0xb9,0xdf,
|
|
||||||
0x0f,0xfa,0x9e,0x77,0x66,0xdf,0x13,0x4e,0x3f,0xe3,0xf4,0x3e,0xa7,
|
|
||||||
0x9f,0x7e,0x6a,0x9f,0x93,0xfb,0xf6,0x3c,0xf9,0xc0,0x21,0x5f,0x1d,
|
|
||||||
0xd8,0x31,0xf6,0x4a,0x06,0x67,0x37,0x96,0x67,0xd6,0xdf,0x2a,0xbe,
|
|
||||||
0x56,0x4f,0x4b,0xdf,0xe8,0xdf,0xe3,0xbe,0x7d,0xcf,0x6b,0x3f,0xb3,
|
|
||||||
0xfd,0xb9,0x07,0x3c,0x71,0xcc,0x09,0xbd,0xfe,0xed,0x03,0xf3,0xef,
|
|
||||||
0xf8,0xee,0xbf,0xf9,0x72,0x3e,0xff,0x9e,0x69,0xf9,0xbe,0xd4,0x2d,
|
|
||||||
0xfe,0xd8,0x00,0xfe,0x07,0x8d,0x79,0xc5,0x62,0xba,0x5f,0x72,0xda,
|
|
||||||
0xf9,0x85,0xef,0x9d,0x72,0xca,0x51,0xbd,0xba,0x9e,0x7a,0x58,0xef,
|
|
||||||
0x2e,0xa7,0x76,0x69,0xd5,0xed,0x94,0xa3,0x7b,0xf5,0x3e,0xbd,0xa9,
|
|
||||||
0xf7,0x1e,0xa5,0xbd,0x87,0x96,0xea,0xf3,0x4b,0xab,0x9b,0x5b,0xbe,
|
|
||||||
0x1b,0xeb,0xa6,0x62,0x53,0x75,0xff,0xec,0x98,0xf4,0x8c,0xe4,0x94,
|
|
||||||
0xd8,0x2d,0x69,0x7f,0xd1,0xa1,0x93,0x7a,0x6f,0x7a,0x0d,0xf0,0xd8,
|
|
||||||
0xdf,0xf4,0xfc,0xee,0xb7,0xff,0x6d,0xb7,0xea,0x90,0xfa,0x0b,0xf6,
|
|
||||||
0xbf,0xc0,0xd6,0xae,0x31,0xbe,0xd8,0xad,0x78,0xcc,0xe0,0xc2,0x69,
|
|
||||||
0x87,0xf6,0x39,0xec,0xb4,0xae,0xbd,0xbb,0x9d,0xd6,0xad,0xe9,0x0f,
|
|
||||||
0xba,0x36,0x75,0x39,0xf5,0xdb,0x4d,0xc7,0xf4,0x6b,0x73,0xf6,0xe9,
|
|
||||||
0xd9,0xd3,0xe5,0x96,0xcb,0xbf,0xdf,0x58,0x58,0x18,0x97,0xdd,0x5a,
|
|
||||||
0x9a,0x50,0x9f,0x5b,0x7a,0xb2,0x3e,0xba,0x34,0x30,0x76,0xaa,0x7e,
|
|
||||||
0xfb,0xf4,0xa6,0xb7,0xd7,0xbf,0x17,0x9c,0xcf,0xbf,0xd3,0xda,0x2f,
|
|
||||||
0x39,0x20,0xbd,0x26,0x79,0xc3,0xfb,0x1f,0xc0,0xd6,0xae,0x71,0x6f,
|
|
||||||
0xf1,0xe0,0xc2,0x01,0x83,0x4f,0x38,0xa5,0x6b,0xaf,0x0f,0xce,0xbe,
|
|
||||||
0x6e,0x4d,0x5d,0x5b,0x7e,0x9e,0x7a,0x44,0xaf,0xae,0xfd,0x3e,0x77,
|
|
||||||
0xf6,0x29,0xd9,0x53,0xe5,0x96,0xf7,0x49,0xd6,0x36,0xbf,0x5f,0x58,
|
|
||||||
0xd6,0xfc,0x6e,0xf1,0xbd,0x96,0xe3,0x05,0x1b,0x4b,0x0b,0x0f,0x67,
|
|
||||||
0x03,0xcb,0x1d,0xfb,0x7d,0xf7,0xc1,0xd6,0xfd,0x6f,0x9f,0x9e,0xbf,
|
|
||||||
0xeb,0x76,0xc1,0x17,0x1f,0x39,0x23,0x7b,0xb0,0xbc,0x62,0x4b,0x3f,
|
|
||||||
0x2e,0x80,0xff,0x4d,0x63,0x66,0xf1,0xa2,0xb8,0x47,0xb2,0xf7,0x39,
|
|
||||||
0x47,0x9d,0x76,0xf4,0x29,0x47,0x1c,0x7b,0xf8,0xa9,0x87,0xf7,0x3a,
|
|
||||||
0xfc,0xb4,0xf5,0xbe,0x7d,0xea,0x91,0x3d,0x8f,0x3c,0xfd,0xd0,0xde,
|
|
||||||
0x6d,0x4b,0x7b,0x0e,0xbb,0x38,0x9b,0x50,0x7e,0xac,0x7e,0x5f,0xe9,
|
|
||||||
0xee,0xfa,0xdd,0xe5,0x7b,0xea,0xe3,0x4a,0x0f,0xd4,0xe7,0x94,0x5e,
|
|
||||||
0x6a,0xbc,0x53,0x7c,0x23,0x5f,0x03,0x1e,0x39,0xa8,0x69,0x54,0xd3,
|
|
||||||
0xf1,0xc7,0xfe,0xae,0xe7,0x89,0x5d,0x7f,0xf5,0xc5,0xca,0x51,0x97,
|
|
||||||
0x5f,0x57,0x7f,0xad,0xb4,0x6e,0x4b,0x3f,0x2e,0x80,0xff,0xd5,0xb2,
|
|
||||||
0xc2,0xc4,0xac,0x5f,0xb9,0x43,0xd2,0xae,0xb4,0xc7,0xf9,0x07,0x7c,
|
|
||||||
0xef,0xb0,0x33,0x0e,0xef,0x73,0xf8,0xe9,0x87,0xf7,0x3e,0xfc,0xf4,
|
|
||||||
0xae,0xbd,0x3b,0xf7,0xdd,0xef,0x94,0x2f,0x0f,0xd9,0xe5,0x92,0xaf,
|
|
||||||
0xc5,0x1e,0xc9,0x19,0xe9,0xc9,0x49,0xf7,0xf4,0x90,0xa4,0x63,0xba,
|
|
||||||
0x6f,0xe8,0x90,0x1e,0x10,0x8e,0x48,0xfb,0x24,0xfd,0xb3,0x6b,0xca,
|
|
||||||
0x53,0xeb,0x77,0x96,0x9a,0x86,0x35,0xdd,0x70,0xc2,0x89,0x47,0xfe,
|
|
||||||
0xeb,0xbe,0x17,0xef,0x36,0xbe,0x47,0x7a,0x65,0x65,0x7e,0x63,0x55,
|
|
||||||
0x71,0xcb,0x3f,0x2e,0x80,0xff,0xdd,0xdb,0xf5,0x47,0x8a,0x3f,0x4c,
|
|
||||||
0xcf,0xac,0x74,0xae,0x7d,0x35,0x7c,0xb9,0xf4,0xf9,0x61,0xbb,0x0c,
|
|
||||||
0xfd,0xdc,0x25,0xbb,0x14,0xda,0x0c,0xde,0x35,0x7c,0xb5,0x72,0x60,
|
|
||||||
0x3c,0x3c,0x74,0x89,0xfb,0x25,0x87,0x0d,0xbd,0x30,0xfe,0xf4,0xb4,
|
|
||||||
0xfb,0x1a,0x13,0xfb,0x4c,0x1c,0x3e,0xe9,0xb8,0xfb,0x87,0xdf,0x7e,
|
|
||||||
0x72,0xb9,0x71,0xec,0xb0,0x0e,0xb5,0x13,0xd2,0x8b,0x2a,0xdd,0x8a,
|
|
||||||
0xfb,0x5c,0xb5,0xe7,0xa0,0xaf,0xde,0x71,0x50,0x3c,0x2f,0xb9,0xa5,
|
|
||||||
0xfe,0x6c,0x69,0xe5,0x56,0xf0,0x98,0x00,0x3e,0x9c,0x55,0x85,0xd7,
|
|
||||||
0xeb,0x73,0x8b,0x63,0xb3,0x6b,0x4b,0x21,0x3d,0xa3,0x72,0x6c,0xda,
|
|
||||||
0x23,0x39,0x36,0x3d,0x33,0xa9,0x65,0x57,0x94,0x8b,0xe9,0x77,0x2a,
|
|
||||||
0x1d,0x07,0x5f,0x1f,0x97,0x1e,0xf6,0xfe,0xc8,0x95,0xed,0x57,0x5c,
|
|
||||||
0xb1,0x62,0xaf,0xf5,0x56,0xee,0xb3,0xf2,0xf2,0x95,0x07,0x4f,0x1b,
|
|
||||||
0x79,0x4c,0x3e,0x03,0xbf,0x9d,0x1e,0x11,0x7a,0xa7,0x83,0x2b,0x37,
|
|
||||||
0x67,0x33,0x4b,0xaf,0xff,0x05,0xc7,0xfd,0xcd,0xca,0xce,0x2a,0xef,
|
|
||||||
0x50,0xdb,0xa1,0xd6,0x35,0x1d,0x5d,0xd9,0xfc,0x74,0xdf,0xfa,0x3b,
|
|
||||||
0xe5,0x2d,0xff,0x1c,0x01,0x5b,0xbf,0x75,0xb9,0xb5,0x85,0xb5,0xcd,
|
|
||||||
0xeb,0x3f,0xd3,0xf6,0xa7,0xfc,0xdd,0xfb,0xcd,0xef,0x16,0x7e,0xde,
|
|
||||||
0x98,0x57,0x9c,0x5d,0x9f,0x53,0x9a,0x53,0x5f,0x50,0xfc,0x45,0xfd,
|
|
||||||
0x89,0x62,0xff,0xda,0xfe,0xc9,0xf4,0xee,0xef,0x8f,0x78,0x6f,0xf7,
|
|
||||||
0xe5,0x57,0x2e,0xdb,0x73,0xd9,0x95,0xef,0xed,0xb9,0xfc,0xca,0xe5,
|
|
||||||
0x7b,0x6e,0xf8,0xfd,0x6b,0x2b,0xae,0x78,0xbd,0xa9,0xeb,0xf0,0xc3,
|
|
||||||
0xd3,0xab,0x2b,0xb3,0xea,0x0b,0x8b,0x6f,0x34,0x56,0xe4,0xb7,0xbb,
|
|
||||||
0xee,0xcf,0xba,0xdf,0xef,0xd4,0xfb,0x96,0x3f,0x7e,0xff,0x3f,0x14,
|
|
||||||
0x5a,0xbe,0x67,0xe1,0xb3,0xf7,0xef,0x38,0xec,0xc9,0xfa,0xac,0xd2,
|
|
||||||
0xc6,0xd3,0x9f,0xba,0xa9,0xef,0x07,0xf6,0xd3,0x7d,0xe3,0x0e,0xc1,
|
|
||||||
0x4c,0x04,0xfe,0xd8,0xba,0xe6,0x35,0xad,0xef,0xd1,0xbe,0x9f,0xcf,
|
|
||||||
0xc0,0x35,0x1b,0xbe,0xd3,0xe5,0xcf,0xbe,0xbe,0xc6,0xec,0xe2,0x71,
|
|
||||||
0x43,0x4f,0xad,0xae,0xee,0xb0,0xfc,0xf2,0xe5,0xad,0x73,0x6f,0xd9,
|
|
||||||
0x95,0xcb,0x37,0xcc,0xbf,0x56,0x7b,0x2c,0xbf,0x72,0x45,0xb7,0xfe,
|
|
||||||
0x97,0x1e,0x94,0xde,0x5b,0x59,0x95,0xdf,0xe6,0xca,0xe6,0x95,0xc5,
|
|
||||||
0xf7,0xf3,0xdb,0xff,0x93,0x6f,0xb3,0xf1,0x64,0xf1,0xac,0x9b,0x3e,
|
|
||||||
0x55,0xdc,0xf4,0x3d,0x83,0x6f,0xfe,0xc3,0x80,0xb3,0xf2,0x99,0xfa,
|
|
||||||
0xc9,0x45,0x6d,0x2f,0x69,0x3d,0xbd,0x70,0xa7,0x4b,0xea,0xf5,0x5f,
|
|
||||||
0x95,0x5a,0x2e,0xdb,0x32,0x27,0x5b,0xce,0xff,0xd4,0x4d,0xd1,0x6b,
|
|
||||||
0x8c,0xb0,0x9d,0x5b,0xd7,0x3a,0xc3,0x3e,0x9c,0xd5,0x8d,0xa5,0x85,
|
|
||||||
0x57,0x1b,0x8b,0x0a,0x0b,0x1b,0x4f,0x17,0xe7,0x35,0x9e,0x2f,0xbe,
|
|
||||||
0xd4,0x78,0xa5,0xf0,0x7a,0xe3,0x97,0x85,0x15,0xad,0x33,0xe9,0xc3,
|
|
||||||
0x5f,0xcf,0x26,0x8d,0xa7,0x0b,0x3f,0x08,0x1d,0xc3,0xe4,0x6f,0xae,
|
|
||||||
0xb8,0x6c,0xc5,0x9e,0xef,0xe5,0x6b,0xbf,0xcd,0xe7,0xdf,0x7b,0x57,
|
|
||||||
0xae,0xc8,0xd7,0x7f,0xcf,0x37,0xed,0x3f,0xfc,0xa8,0xec,0x8e,0xca,
|
|
||||||
0x73,0xf9,0x0c,0x9b,0x95,0xaf,0xd9,0xe6,0xe4,0xb7,0xfb,0x8b,0xc6,
|
|
||||||
0x7b,0x7f,0xd2,0xed,0xbc,0x98,0xef,0x73,0xff,0xe1,0xcd,0xb6,0x03,
|
|
||||||
0x36,0xcd,0xbf,0x7f,0x6d,0x73,0xe1,0x67,0xb2,0x75,0xe5,0xae,0x63,
|
|
||||||
0x3f,0x3b,0xac,0xf5,0xf4,0xda,0x5d,0x2e,0xda,0x35,0x3f,0xdd,0x72,
|
|
||||||
0xd9,0xc1,0x1b,0xe6,0xe4,0x4e,0xd7,0x8d,0x2a,0xfd,0x59,0x8f,0x09,
|
|
||||||
0xd8,0x76,0x34,0x3e,0xac,0x25,0x85,0x87,0xb2,0x6b,0x4a,0x85,0x74,
|
|
||||||
0x50,0xe5,0xa2,0xf4,0x9c,0xca,0xf9,0xe9,0x80,0xca,0xe0,0x74,0x70,
|
|
||||||
0xa5,0x91,0x5d,0x5f,0x1e,0x5d,0x7f,0xb2,0xf8,0xde,0x87,0xbe,0x9e,
|
|
||||||
0xcd,0xbd,0x5e,0xb8,0x21,0xed,0x53,0xd9,0xfb,0xec,0x4b,0xb3,0x17,
|
|
||||||
0xf7,0x59,0x71,0x79,0xeb,0x6b,0x7f,0x5f,0x5b,0xd1,0x3a,0xf7,0x5a,
|
|
||||||
0x7e,0x7f,0xe3,0xc0,0xdb,0x2e,0xfb,0xe6,0xb0,0xbd,0x6a,0x27,0xe7,
|
|
||||||
0xb7,0x35,0x30,0x3d,0xad,0xd2,0x14,0x9b,0x92,0x33,0xd2,0xfe,0x95,
|
|
||||||
0x5a,0x36,0xb6,0xfc,0x4a,0xeb,0xff,0x87,0xf4,0xe1,0x6e,0xa7,0xef,
|
|
||||||
0xa8,0x4f,0x17,0x37,0xae,0xfb,0x76,0x5a,0xb8,0x7e,0xcd,0xb7,0x63,
|
|
||||||
0xf3,0x92,0xf2,0x55,0x37,0x7c,0x72,0xd3,0x9a,0xf0,0x13,0x57,0x4f,
|
|
||||||
0x28,0xad,0x6b,0x3c,0x5f,0xf8,0xd8,0x8c,0x36,0x43,0x5a,0xe6,0x63,
|
|
||||||
0xcb,0xbf,0xff,0xe9,0x8f,0x07,0xd8,0x1e,0xfd,0xa2,0x7e,0x7d,0xa9,
|
|
||||||
0xa9,0x76,0x64,0x72,0x62,0xed,0xfc,0x30,0x20,0x0e,0x0a,0x83,0xe2,
|
|
||||||
0x80,0x70,0x4e,0xed,0xa4,0x70,0x6c,0x3c,0x32,0x74,0x49,0x2f,0x4e,
|
|
||||||
0xde,0xf8,0xb3,0xae,0x77,0x6d,0xe1,0x95,0xfa,0xe8,0xe2,0xf7,0xe3,
|
|
||||||
0xbe,0xc9,0x7e,0xfd,0x4e,0x4d,0x1b,0xc7,0x8c,0x19,0x31,0xed,0xe0,
|
|
||||||
0x69,0x23,0x1f,0x3c,0x74,0xdc,0xc8,0x1f,0xf5,0x39,0xa7,0xf9,0x5b,
|
|
||||||
0xc3,0x76,0xab,0x1d,0x16,0x8f,0x49,0x0e,0x88,0xdd,0xc3,0x45,0xb1,
|
|
||||||
0x5a,0xad,0xd5,0x92,0xea,0xa0,0x78,0x66,0x38,0xac,0xd6,0x25,0xa4,
|
|
||||||
0xd9,0x82,0x0f,0x37,0x9f,0xb2,0xc1,0xa5,0x8d,0x33,0xef,0x73,0x13,
|
|
||||||
0x3a,0x0c,0xfb,0xc4,0xfc,0xb6,0x83,0x5a,0x7e,0xdf,0x21,0x5d,0x57,
|
|
||||||
0x59,0xd2,0xbc,0x63,0x79,0xe3,0xfc,0xfb,0x87,0x3b,0xce,0x6a,0xbd,
|
|
||||||
0xec,0xa7,0x5e,0x69,0x3b,0xb0,0xed,0xe2,0x4f,0x0f,0x18,0x98,0xad,
|
|
||||||
0x2b,0x6d,0xe9,0xe7,0x1c,0xd8,0x1a,0x2c,0x2f,0xdc,0x9c,0x1d,0x5c,
|
|
||||||
0x19,0x5a,0x9b,0x1c,0x66,0xc5,0x39,0x61,0x6e,0x3a,0x2f,0xcc,0x8f,
|
|
||||||
0x4f,0x87,0xd9,0x71,0x56,0x98,0x1a,0xc7,0x55,0x4f,0xc9,0xe7,0xd1,
|
|
||||||
0x73,0x8d,0xb7,0x0b,0x6f,0x36,0xde,0x2c,0xb6,0x58,0x96,0xaf,0x15,
|
|
||||||
0x17,0xd4,0xe7,0x14,0xe7,0xd4,0xe7,0xe7,0xa7,0x37,0x5e,0xc7,0x3b,
|
|
||||||
0x85,0xe7,0xeb,0x33,0x8b,0x13,0xeb,0x63,0x4b,0x63,0xeb,0x13,0x4a,
|
|
||||||
0x8f,0xd5,0x9f,0x2d,0xbe,0xdd,0x7a,0xfe,0xbb,0x85,0xc7,0xb3,0x9f,
|
|
||||||
0x94,0xce,0x8b,0x47,0x54,0xf6,0xaf,0x7d,0x39,0xb4,0x49,0xda,0x54,
|
|
||||||
0xdb,0x84,0x76,0xd5,0xf6,0xb1,0x6b,0x72,0x4a,0x5a,0xac,0x9c,0x1b,
|
|
||||||
0xf7,0x4b,0xae,0xaa,0xcd,0xab,0xbe,0x12,0x17,0x55,0x9f,0x89,0x0b,
|
|
||||||
0xc2,0xd3,0x71,0x56,0x75,0x6c,0xed,0xec,0xd0,0x3e,0x6d,0xae,0xfc,
|
|
||||||
0xa2,0xb1,0xa4,0xb8,0xfe,0x36,0xdf,0x28,0x2e,0x69,0xac,0x2a,0xac,
|
|
||||||
0x6a,0xbc,0xb5,0xe9,0x3e,0xbc,0xd9,0x78,0xab,0x75,0x4d,0xfa,0x44,
|
|
||||||
0x3e,0xe3,0xda,0xfc,0xeb,0xfa,0x3d,0xef,0xc7,0x2e,0xbd,0xa6,0xd2,
|
|
||||||
0x3a,0xff,0x5a,0xf6,0xbf,0x69,0xbe,0xdf,0xcd,0x3a,0x94,0x3f,0xb7,
|
|
||||||
0xaa,0x6d,0xff,0x96,0xf9,0xd7,0x66,0xda,0x67,0x86,0xae,0x4b,0x3f,
|
|
||||||
0xb3,0xfe,0xb2,0x4f,0x7c,0x6c,0xf0,0xf3,0x5b,0xfc,0x39,0x07,0xb6,
|
|
||||||
0x0a,0xf5,0xd9,0x85,0xee,0xb5,0x21,0xe1,0xd5,0xf4,0xa9,0x30,0x33,
|
|
||||||
0x7b,0x24,0x3c,0x9c,0x3e,0x12,0x1e,0x49,0xa7,0x27,0x8f,0xa6,0x33,
|
|
||||||
0xc2,0x13,0xf1,0xd9,0x70,0x66,0xbe,0x2e,0x4c,0xd3,0x21,0x95,0x21,
|
|
||||||
0xb9,0x41,0xe9,0xb0,0xca,0xcd,0xd9,0x88,0xf2,0xa9,0xf1,0xe4,0xe4,
|
|
||||||
0xc4,0xdc,0xf0,0x6c,0x41,0xbe,0x8e,0x5a,0x5d,0x78,0x32,0xbb,0xa2,
|
|
||||||
0xd4,0x37,0x9e,0x98,0x9c,0x10,0x7b,0x26,0x3d,0xe3,0x71,0xc9,0xf1,
|
|
||||||
0xf1,0x8c,0x4a,0x73,0x36,0xbd,0xb4,0x2c,0xbf,0xfe,0xb7,0xeb,0xe3,
|
|
||||||
0x8b,0x97,0xc4,0x63,0x2b,0xdd,0x62,0xe7,0xa4,0x53,0x6d,0xff,0xd0,
|
|
||||||
0x31,0xee,0x17,0xba,0xc4,0x13,0x92,0x8b,0xd2,0x46,0xf9,0xb0,0xda,
|
|
||||||
0x4f,0xc3,0x9a,0xb8,0x38,0xcc,0xcb,0x6f,0x6b,0x46,0xfa,0x50,0x98,
|
|
||||||
0x9a,0x3e,0x54,0x7d,0x3c,0x9d,0x56,0x6d,0xaa,0x75,0x4d,0xb2,0x74,
|
|
||||||
0x50,0x79,0x48,0xeb,0xed,0x0e,0xac,0xb4,0xac,0x07,0x1f,0xcd,0x8a,
|
|
||||||
0xe5,0xc1,0x9b,0xee,0x47,0xa5,0x32,0xab,0xbe,0xae,0x78,0xd6,0x1d,
|
|
||||||
0xeb,0xdf,0xe3,0x6d,0xfb,0xca,0xa7,0x06,0x0e,0x4e,0xaf,0x6a,0x7d,
|
|
||||||
0x6f,0xa3,0xed,0xd2,0x9d,0x2f,0x6e,0x6a,0x59,0xdf,0xd5,0xe3,0xfa,
|
|
||||||
0xf5,0xde,0x86,0xf7,0x40,0x36,0xee,0x87,0x5b,0xd7,0x82,0x5b,0xfa,
|
|
||||||
0x39,0x07,0xfe,0xf6,0x3e,0xc4,0x6b,0x84,0xab,0xeb,0x57,0x15,0x0f,
|
|
||||||
0x8c,0xaf,0x55,0x67,0x64,0xb7,0x86,0x51,0xd9,0xe8,0x64,0x4c,0x76,
|
|
||||||
0x77,0xb8,0x3b,0xbd,0x3b,0x8c,0x49,0x6f,0x0b,0xa3,0xd3,0x3b,0xc3,
|
|
||||||
0x41,0xb5,0xe3,0x92,0x5e,0xb5,0xfe,0xe1,0xbc,0x7c,0x6f,0x7c,0x41,
|
|
||||||
0xed,0xa0,0xea,0xa1,0xf1,0xa4,0x50,0x8e,0x97,0x56,0x1b,0xf9,0x5e,
|
|
||||||
0xb5,0x43,0x5a,0x4d,0xde,0xa8,0x3f,0x51,0xfc,0x41,0xfc,0x4e,0x32,
|
|
||||||
0x30,0x0e,0xaf,0x5e,0x13,0xaf,0x0b,0xd7,0xd4,0xae,0xa8,0x26,0xf1,
|
|
||||||
0xcc,0x6a,0xe7,0x5a,0x9f,0x70,0x7f,0x7d,0x49,0xf1,0xc6,0xb4,0x7b,
|
|
||||||
0xe5,0xc4,0x5a,0xa1,0xda,0xc8,0xcf,0xbf,0x2a,0xfe,0x30,0x0c,0xaf,
|
|
||||||
0x85,0xea,0x90,0xfc,0xba,0x8e,0x8a,0x87,0x85,0x33,0x6a,0xff,0x51,
|
|
||||||
0x7d,0x26,0xbb,0x3f,0xdc,0x95,0x8e,0x0b,0x63,0xd3,0x7b,0xc2,0x8d,
|
|
||||||
0xe9,0x0d,0xd5,0x51,0xf9,0xfc,0xbb,0x2e,0xee,0x19,0x0e,0xc9,0x67,
|
|
||||||
0xf2,0xb9,0xb5,0x73,0xc2,0x79,0xf1,0xd4,0xb0,0x4f,0xfa,0xb3,0x64,
|
|
||||||
0x50,0xbe,0x57,0xee,0x5f,0xfb,0x41,0x38,0x27,0x5e,0x10,0x4e,0x8b,
|
|
||||||
0xbb,0x87,0xeb,0xeb,0x4f,0x94,0x3e,0xf6,0x44,0xdb,0xc1,0xad,0xf3,
|
|
||||||
0x2d,0x5f,0xd3,0x3d,0x57,0x1f,0x50,0xfa,0xf4,0xe2,0xb6,0x03,0xda,
|
|
||||||
0xce,0xff,0xc4,0xa0,0x09,0x8d,0x75,0xc5,0x75,0x8d,0x99,0xc5,0x8f,
|
|
||||||
0xcf,0xdd,0xf0,0xef,0xf9,0x9e,0xb7,0xc3,0x84,0xcf,0xb5,0xbe,0x1f,
|
|
||||||
0xf2,0xb1,0x91,0x4f,0x94,0xb7,0xf8,0xeb,0xb2,0xc0,0x56,0x61,0x49,
|
|
||||||
0x76,0x66,0xb9,0x16,0x5f,0xad,0x5e,0x97,0x8d,0x49,0xc6,0x65,0x13,
|
|
||||||
0xc3,0x83,0xd9,0x94,0x30,0x29,0x9d,0x18,0xc6,0xa5,0x63,0xc3,0xf8,
|
|
||||||
0xf4,0x27,0x61,0x9f,0xd8,0x2b,0xfc,0x30,0xbe,0x59,0x9d,0x9f,0xaf,
|
|
||||||
0x05,0x9f,0x8b,0x47,0x87,0xee,0xb5,0xa7,0xaa,0x6f,0xc5,0x5f,0x84,
|
|
||||||
0xc5,0xd9,0x82,0x7c,0x0e,0x1d,0x14,0x26,0x65,0xa5,0x72,0xb7,0xda,
|
|
||||||
0xc4,0x7c,0x0f,0xfb,0x52,0x78,0x29,0xbe,0x1c,0x5e,0x4a,0x9f,0x0d,
|
|
||||||
0x4f,0xc5,0x47,0xab,0x23,0x6a,0x5f,0xaf,0x7e,0x2f,0xbb,0xb7,0x72,
|
|
||||||
0x74,0xed,0x82,0x30,0x37,0xbf,0xfc,0x1b,0xe9,0x92,0xf0,0x6e,0xf6,
|
|
||||||
0x6e,0x58,0x9a,0xbe,0x15,0x16,0xa7,0x6f,0x86,0x4b,0x62,0xbb,0xea,
|
|
||||||
0x63,0xf1,0xd5,0x7c,0xc6,0x8e,0x0b,0x93,0xe2,0xcd,0xe1,0xa2,0x98,
|
|
||||||
0xe4,0x73,0x77,0x54,0xf5,0x96,0xf4,0x96,0x70,0x6f,0xfa,0xcd,0xea,
|
|
||||||
0x5e,0xf1,0xc5,0xea,0xa2,0x74,0x4e,0x98,0x9f,0x3e,0x1a,0xda,0xc7,
|
|
||||||
0x0b,0x92,0xa3,0xe2,0xd4,0xf0,0x5c,0x7e,0x7a,0x5e,0xfa,0x5c,0x18,
|
|
||||||
0x14,0xbf,0x10,0x7e,0x96,0x9d,0x55,0xd9,0xf8,0xbe,0xef,0x67,0xc7,
|
|
||||||
0x76,0x19,0xb6,0x2e,0xeb,0x52,0xfe,0xec,0xb2,0xb6,0xfd,0x77,0xbe,
|
|
||||||
0xab,0x69,0xd8,0xc6,0xc7,0xb6,0xeb,0xe4,0x5d,0x86,0xb6,0xce,0xbf,
|
|
||||||
0x55,0x9f,0xeb,0xdf,0xba,0x37,0x6e,0x39,0x36,0xa6,0xbe,0xce,0x7b,
|
|
||||||
0xbf,0x40,0xab,0x67,0xb2,0xae,0xe5,0x99,0xe9,0xd4,0x70,0x6f,0x36,
|
|
||||||
0x31,0x99,0x94,0x4d,0x4a,0xae,0x4e,0xcb,0xa1,0x10,0x87,0x56,0x87,
|
|
||||||
0xc4,0x6a,0xf5,0x47,0x71,0x58,0xd8,0x2f,0x7e,0x3b,0x79,0x3a,0xbe,
|
|
||||||
0x16,0x66,0xa7,0x73,0xc3,0x9c,0xb4,0x6f,0x78,0xbe,0xb6,0xaa,0x3a,
|
|
||||||
0x3b,0x9b,0x9e,0x4c,0xcf,0x16,0xe6,0xf3,0xea,0x2b,0xa1,0x9a,0x76,
|
|
||||||
0x4d,0xa6,0xe5,0xe7,0xcd,0xc8,0x67,0xe6,0xfd,0xe9,0xbd,0xf9,0x5a,
|
|
||||||
0xee,0xde,0xea,0xdd,0xe9,0xa4,0xf0,0x64,0x2c,0xe4,0x7f,0x7b,0x5e,
|
|
||||||
0xd2,0xbb,0xb6,0xbc,0xfa,0x46,0xf6,0x54,0x78,0xbc,0x3e,0x27,0x59,
|
|
||||||
0x50,0x7f,0x26,0x59,0xd8,0x78,0x21,0x79,0xa5,0xfe,0x5e,0x38,0x39,
|
|
||||||
0xee,0x57,0x7d,0x27,0x1d,0x9f,0xff,0xcd,0xfd,0x61,0x7c,0x6c,0x0a,
|
|
||||||
0xbb,0xd5,0x3a,0x84,0x9b,0xd2,0xfb,0xf2,0x79,0x38,0x3a,0xdc,0x93,
|
|
||||||
0xf6,0xa8,0x76,0x8c,0x77,0x87,0x9f,0x67,0x8f,0x85,0x59,0xd9,0x9c,
|
|
||||||
0xa4,0x47,0x3c,0x38,0x29,0xc4,0x95,0xd5,0x47,0xf3,0xd3,0xf3,0xb2,
|
|
||||||
0x51,0x61,0xaf,0x78,0x52,0xf2,0x60,0xf3,0x8e,0x95,0xd6,0xd7,0xf3,
|
|
||||||
0x5a,0x8f,0x71,0x8e,0xc5,0x75,0xd9,0x0e,0x95,0xd6,0xbd,0x6f,0x3a,
|
|
||||||
0x79,0xd3,0xfa,0x6e,0xc0,0xa8,0x4f,0x17,0x36,0xbe,0x07,0xd2,0xfa,
|
|
||||||
0x5a,0x60,0xbe,0x4e,0x7c,0xa2,0x65,0x6d,0xb8,0x15,0x3c,0xef,0xc0,
|
|
||||||
0x96,0xf7,0x48,0x7a,0x60,0xe5,0xb5,0x7c,0x76,0x4d,0xcc,0x26,0x85,
|
|
||||||
0x87,0xb3,0xbb,0xc2,0x7e,0xb5,0x2f,0x86,0xdd,0x6b,0xbb,0x87,0x3d,
|
|
||||||
0x6a,0xed,0xf3,0x3d,0xe8,0x01,0xa1,0x4b,0xec,0x96,0xbc,0x19,0xa7,
|
|
||||||
0xe4,0xeb,0xc1,0xfb,0xf2,0x3d,0xea,0xd4,0xf0,0x4e,0x36,0x2e,0xb9,
|
|
||||||
0x3f,0x9b,0x90,0x8c,0xcf,0xa6,0x26,0xe3,0xd2,0x7d,0x42,0x9f,0xda,
|
|
||||||
0xc0,0xf0,0xaf,0xe9,0x5d,0xe1,0x8e,0x7c,0xcf,0x7c,0x73,0x1c,0x1a,
|
|
||||||
0xce,0x8f,0x57,0x56,0x47,0xa7,0x37,0xe7,0x73,0x70,0x74,0xe8,0x10,
|
|
||||||
0xbb,0x84,0x29,0xf1,0xf5,0x30,0xbe,0x3e,0x25,0x99,0x56,0x7f,0x24,
|
|
||||||
0x4c,0xcb,0x26,0xe4,0x7b,0xe2,0xa9,0x61,0x46,0xf6,0x48,0xd8,0xb3,
|
|
||||||
0x76,0x5c,0xbe,0x8e,0xbc,0x37,0x5f,0x63,0x4e,0x08,0x3f,0xca,0xd7,
|
|
||||||
0x73,0x83,0xd2,0x13,0x2a,0x97,0xc7,0xc7,0xc3,0x6d,0xd9,0x98,0x7c,
|
|
||||||
0xfd,0xd7,0x2b,0x74,0x8d,0x67,0x84,0xa7,0xb2,0x3b,0x93,0x3b,0xeb,
|
|
||||||
0x93,0x93,0x73,0xe3,0xd7,0xab,0x2f,0xc5,0x19,0xc9,0xed,0xd9,0xb8,
|
|
||||||
0x7c,0x3e,0x7e,0x23,0x74,0x4a,0xc7,0x54,0xae,0xb8,0xe1,0x93,0xa5,
|
|
||||||
0x8d,0xb3,0xed,0xe3,0x57,0xce,0x2c,0xaf,0xab,0xf7,0x2d,0xed,0x50,
|
|
||||||
0x6b,0x0a,0x1d,0x6a,0x9f,0x09,0x83,0x36,0xac,0xf1,0x46,0x5d,0xb7,
|
|
||||||
0xd3,0xa6,0xcb,0x6c,0x7a,0xed,0x6f,0x2b,0x78,0xce,0x81,0xad,0xc3,
|
|
||||||
0xe4,0xb4,0x4b,0xe5,0xad,0x7c,0xdd,0x37,0x39,0xdf,0xf7,0x3e,0x96,
|
|
||||||
0xde,0x16,0xda,0xd7,0xbe,0x95,0xcf,0xbc,0x2e,0xe1,0x90,0xb8,0x7f,
|
|
||||||
0xfe,0xb3,0x47,0x72,0x76,0x3c,0x3e,0x79,0x2f,0x4e,0xca,0xe7,0xe3,
|
|
||||||
0xe4,0x30,0x35,0x5f,0xc7,0x3d,0x90,0x4d,0x4e,0x1e,0xc8,0xa6,0x24,
|
|
||||||
0x13,0xb3,0x07,0x93,0xd1,0x71,0xaf,0xd0,0x39,0xdf,0x17,0x3f,0x96,
|
|
||||||
0xde,0x51,0x1d,0x9f,0xde,0x13,0x4e,0x88,0x5f,0xad,0xee,0x5b,0x3b,
|
|
||||||
0x26,0x4c,0x4e,0xef,0xc8,0xe7,0x5f,0xcb,0x2c,0x3d,0x38,0xfc,0x32,
|
|
||||||
0x3e,0x94,0xcf,0xbd,0x87,0xc3,0x13,0xd9,0x4d,0xc9,0x59,0xf1,0xb8,
|
|
||||||
0xd0,0x14,0xcf,0x0c,0x85,0x74,0x68,0x68,0x53,0xbb,0x30,0xdf,0x2b,
|
|
||||||
0xdf,0x9b,0xaf,0xf5,0x26,0x86,0x62,0xdc,0x37,0x8c,0xce,0x4e,0xad,
|
|
||||||
0x8c,0x8b,0x33,0xaa,0xa3,0xf3,0x19,0x3c,0x36,0xed,0x91,0x5f,0xd7,
|
|
||||||
0x91,0xc9,0x93,0xe9,0x7d,0xc9,0xbd,0xf9,0x5c,0xbe,0x3c,0xad,0x84,
|
|
||||||
0xb7,0xd3,0xd1,0xf9,0xef,0x53,0xf2,0xfb,0xf3,0xf9,0x50,0xad,0xbf,
|
|
||||||
0x5e,0x6a,0xba,0x6b,0xe7,0x61,0x9b,0x1f,0xef,0xbc,0xae,0x31,0xb9,
|
|
||||||
0xd8,0x74,0xcd,0x4e,0xe5,0xcf,0x2d,0x6f,0xd3,0xff,0x33,0x1b,0x8e,
|
|
||||||
0x77,0x5e,0x97,0x6d,0x78,0xcf,0x77,0xc3,0xfc,0xf3,0xda,0x1f,0xb0,
|
|
||||||
0xb9,0x29,0xf9,0xfc,0x7b,0x3b,0x5f,0xd7,0x4d,0xcd,0xa6,0x86,0x29,
|
|
||||||
0xe9,0x03,0x61,0x62,0x9c,0x1c,0x26,0xd5,0x26,0x86,0x31,0xf1,0x82,
|
|
||||||
0xea,0x7e,0x69,0x73,0x52,0x49,0x07,0x25,0xef,0xe6,0x7b,0xd4,0x29,
|
|
||||||
0xf9,0x7a,0x6f,0x46,0x36,0x2b,0x3c,0x99,0x4d,0xcb,0x7f,0x9f,0x1c,
|
|
||||||
0x26,0xe7,0x6b,0xb8,0x6b,0xe3,0xae,0xf9,0x3e,0xf6,0xad,0x30,0x26,
|
|
||||||
0x1d,0x1b,0x26,0xa6,0x3f,0x0b,0x9f,0xcf,0xd7,0x8b,0xc7,0xc4,0x43,
|
|
||||||
0x92,0x39,0xf1,0xce,0x7c,0xbd,0x38,0x3a,0xec,0x11,0x8f,0xaf,0xae,
|
|
||||||
0xce,0x2f,0xfb,0x70,0xf6,0x58,0xb2,0x30,0x3b,0x33,0x9f,0x79,0x9f,
|
|
||||||
0x0f,0x6d,0x6b,0x6d,0xf2,0xf5,0x65,0xfb,0xb0,0x7f,0xed,0x92,0xb0,
|
|
||||||
0x30,0xde,0x91,0xff,0xed,0x3d,0xe1,0xf2,0xb8,0x67,0x72,0x72,0xec,
|
|
||||||
0x95,0x2c,0x89,0xf7,0x54,0xef,0xce,0xee,0xc9,0xe7,0xdf,0xe1,0xe1,
|
|
||||||
0xc2,0xf4,0x3b,0x95,0x7c,0xf6,0x25,0x63,0xb3,0x7b,0xc3,0x7d,0xd9,
|
|
||||||
0x82,0x7c,0xfe,0xde,0x91,0xdf,0xc7,0xab,0x92,0xcf,0xc7,0xde,0xc9,
|
|
||||||
0xd3,0x8d,0xb5,0xc5,0xcf,0x4c,0x6b,0xb3,0xfe,0xb5,0xbd,0x65,0x9f,
|
|
||||||
0xed,0xdf,0x25,0x9f,0x77,0x4b,0xb3,0xa6,0xd2,0xce,0x4b,0xdb,0x5e,
|
|
||||||
0xdc,0x7a,0xfc,0x5f,0xb6,0xae,0xd2,0xfa,0xf8,0x36,0x3b,0xcf,0x6b,
|
|
||||||
0x7f,0xc0,0x1f,0x9b,0x9a,0xee,0x5b,0x79,0x25,0x9d,0x1b,0x1e,0x6a,
|
|
||||||
0x99,0x6b,0xe9,0xa4,0x30,0x3b,0x9d,0x17,0xe6,0xc4,0x27,0xc3,0xdc,
|
|
||||||
0x74,0x76,0x38,0x2e,0x9e,0x12,0xbe,0x1f,0x6f,0x0b,0x2f,0x67,0xf7,
|
|
||||||
0xe7,0xb3,0x67,0x7a,0x32,0x39,0xed,0x9f,0x54,0xd3,0x59,0xf9,0x7a,
|
|
||||||
0x6e,0x4a,0x3e,0xff,0x66,0x25,0x85,0xf8,0xd5,0x50,0x8f,0x8b,0xc2,
|
|
||||||
0xed,0xf9,0xfc,0x1b,0x97,0xde,0x1e,0x2a,0xb5,0xe1,0xa1,0x11,0x6f,
|
|
||||||
0x0a,0x4f,0xe7,0xb3,0xef,0xbe,0xf4,0xfa,0xea,0x97,0x63,0xbf,0xb0,
|
|
||||||
0x32,0x9f,0x61,0xd3,0xb3,0x47,0x93,0xd9,0xf9,0xfa,0x2f,0xc4,0xcb,
|
|
||||||
0xaa,0x3f,0x8e,0x31,0x1c,0x58,0x3b,0x3c,0x5c,0x94,0x9e,0x18,0x16,
|
|
||||||
0xa6,0xb7,0xe4,0x7f,0x3b,0x2a,0x8c,0x8e,0xe5,0x70,0x49,0x6d,0x6e,
|
|
||||||
0x75,0x6e,0x7e,0x1d,0xe3,0xb3,0xb1,0xf9,0xda,0xb1,0x63,0xa8,0xa5,
|
|
||||||
0xe7,0x56,0x8a,0xd9,0x23,0xc9,0x3d,0xd9,0xd8,0x7c,0xaf,0x3d,0x29,
|
|
||||||
0xdc,0x91,0x8d,0xcf,0xaf,0xb3,0x73,0x68,0x9f,0xde,0x52,0x59,0xdd,
|
|
||||||
0x78,0xae,0xb0,0xe9,0xbd,0xdf,0x0d,0x73,0x2d,0x6e,0xfc,0x0c,0xf0,
|
|
||||||
0x66,0x9f,0x77,0x5b,0xd7,0x18,0x55,0xdc,0x78,0x7c,0x74,0xcb,0x31,
|
|
||||||
0x32,0xd1,0xfc,0x03,0x36,0xf3,0x7c,0xd6,0xb5,0x5c,0x89,0xb3,0xf3,
|
|
||||||
0xb9,0x37,0x3b,0x3c,0x99,0xce,0x0c,0xd3,0xf2,0x7d,0xeb,0x9d,0xe9,
|
|
||||||
0x98,0xdc,0xc3,0x21,0xc4,0x6f,0x86,0xa3,0xe3,0xd3,0x61,0x4e,0x3e,
|
|
||||||
0x7f,0x1e,0xa8,0xcf,0x48,0x7e,0x90,0xee,0x1d,0x0e,0x8a,0x0f,0x87,
|
|
||||||
0xc7,0xf3,0x7d,0xe8,0x94,0x6c,0x66,0x38,0xbe,0xb6,0x4f,0xb8,0x2b,
|
|
||||||
0x3e,0x9e,0x5f,0xb6,0xe5,0x7d,0x8f,0x49,0xd5,0xf9,0xe9,0x8b,0x61,
|
|
||||||
0x51,0xfa,0x72,0x78,0x24,0x9d,0x12,0x1e,0x4f,0x6b,0x61,0x8f,0xda,
|
|
||||||
0x19,0x61,0x5d,0xbe,0xf6,0x9b,0x51,0x9f,0x95,0xcc,0xca,0x9e,0x4e,
|
|
||||||
0x5e,0x49,0x5f,0x0b,0x8b,0xd3,0x57,0xc2,0xf5,0xe9,0x01,0x21,0xa6,
|
|
||||||
0x07,0x27,0xe3,0xf2,0x79,0x3b,0x26,0x9f,0x95,0x77,0xa6,0x33,0xc2,
|
|
||||||
0x2b,0xf9,0xed,0xdc,0x95,0xaf,0xfd,0xc6,0x67,0xf7,0x25,0x37,0xc6,
|
|
||||||
0xdd,0xc3,0xcf,0xb2,0x1f,0x96,0x8f,0xcb,0x67,0xf1,0xe8,0xfa,0xd8,
|
|
||||||
0x70,0x4f,0x76,0x77,0xee,0xe1,0x50,0x8a,0x5f,0x09,0xa1,0xbe,0xb8,
|
|
||||||
0xb4,0xae,0x31,0xa1,0xb8,0xf1,0xb3,0x1e,0x1b,0xe7,0xda,0xc6,0xe3,
|
|
||||||
0x5b,0x36,0x1d,0xff,0xd7,0xf2,0xf8,0x1a,0x4b,0x0a,0x3b,0xce,0x68,
|
|
||||||
0x3b,0x64,0xe3,0x7b,0xc0,0x1d,0x36,0xce,0x45,0x80,0xc6,0xd2,0xc2,
|
|
||||||
0xe3,0xd9,0x80,0xf2,0xfe,0xf1,0xb4,0x30,0x2c,0xc6,0x6a,0x2d,0x2d,
|
|
||||||
0x56,0xaf,0xc9,0xe7,0xdf,0xad,0xf9,0xba,0xec,0xe6,0x74,0x5c,0x18,
|
|
||||||
0x1e,0xdb,0xe7,0xfb,0xd9,0xb7,0xf3,0xb5,0xe1,0x94,0xf0,0x68,0x36,
|
|
||||||
0x31,0xd9,0x27,0x9e,0x95,0x1c,0x16,0x67,0xe5,0xf3,0x70,0x4a,0x78,
|
|
||||||
0x20,0x9d,0x16,0xbe,0x59,0x3b,0x28,0xcc,0x88,0x53,0x5a,0x8f,0x17,
|
|
||||||
0xbc,0x3b,0xbd,0xa5,0x7a,0x53,0x1c,0x15,0x6e,0x4b,0x6f,0x0e,0xd7,
|
|
||||||
0xa4,0xd7,0x87,0x5b,0x63,0xef,0x96,0xd7,0x11,0x93,0x87,0xb3,0xf9,
|
|
||||||
0xc9,0x82,0xfa,0x82,0x64,0x7e,0xfd,0xe9,0x64,0x5e,0x3e,0xcf,0xe6,
|
|
||||||
0x66,0xf3,0xc2,0x63,0x71,0xff,0x7c,0xfe,0x9d,0x55,0x39,0xb6,0x76,
|
|
||||||
0x4d,0xb8,0x23,0xdf,0xff,0xde,0x9b,0xcf,0xcf,0xe1,0xe9,0x6d,0xd5,
|
|
||||||
0xf1,0xe9,0xf8,0x30,0x2e,0x7b,0x20,0xc9,0xe2,0x5e,0xe1,0xce,0x6c,
|
|
||||||
0x60,0xb9,0x5f,0x7c,0x2e,0xdc,0x9e,0x8d,0xcb,0xd7,0x80,0xf7,0xe6,
|
|
||||||
0xe7,0xcf,0x0c,0x17,0xc5,0x4e,0x61,0x6a,0xeb,0xb1,0x7d,0x7f,0xb4,
|
|
||||||
0xae,0xcb,0x66,0x96,0x37,0x1d,0xeb,0xb7,0xf9,0x3a,0xaf,0x3e,0xe8,
|
|
||||||
0x0f,0xc7,0x40,0xb7,0xbe,0xfe,0xf7,0x9c,0xf9,0x07,0x1f,0x11,0x6b,
|
|
||||||
0x5b,0xbf,0xcb,0xef,0xbf,0xb7,0xba,0xf1,0x48,0xf1,0xdc,0xf4,0xbb,
|
|
||||||
0x95,0x43,0xe3,0x9e,0x61,0xcf,0xda,0xde,0x61,0xef,0xb8,0x47,0x38,
|
|
||||||
0x37,0xce,0xae,0xde,0x96,0xef,0x79,0x6f,0x4f,0x27,0x84,0x18,0xbf,
|
|
||||||
0x16,0xce,0x8a,0x2b,0xc3,0xc4,0x6c,0x5a,0x32,0x27,0xfb,0x49,0xd8,
|
|
||||||
0x33,0x5e,0x56,0x39,0x22,0x2e,0x0e,0x33,0xb3,0xc9,0xe1,0xc1,0x7c,
|
|
||||||
0x8d,0xb8,0x47,0xed,0xe8,0x64,0x7e,0x1c,0x57,0x6d,0x3d,0xe6,0x25,
|
|
||||||
0x1e,0x19,0x3a,0xd7,0x0e,0x0b,0x87,0xc4,0x83,0xf2,0x35,0x62,0xa7,
|
|
||||||
0x70,0x68,0xdc,0x27,0xdf,0x3b,0x1f,0x53,0xe9,0x9a,0x5e,0x1c,0x4a,
|
|
||||||
0xe9,0xb0,0x6a,0xbf,0x7c,0x8f,0x3c,0x3b,0x7b,0xa0,0x75,0x8f,0x3d,
|
|
||||||
0x25,0x3d,0xa0,0x7a,0x61,0xbe,0xbf,0x6d,0x5f,0x3b,0x20,0xf4,0xce,
|
|
||||||
0xf7,0xd8,0x27,0xc5,0x6f,0x85,0x0e,0xb5,0x47,0xab,0x93,0xf2,0x3d,
|
|
||||||
0xee,0xf8,0x7c,0xcf,0x7b,0x52,0x3c,0x26,0x5c,0x99,0x76,0xa9,0xcc,
|
|
||||||
0x8e,0x8f,0xe4,0x6b,0xc2,0x89,0x61,0x4a,0x3e,0xff,0xee,0x6f,0x79,
|
|
||||||
0xbd,0xb1,0xf6,0xf5,0x30,0xb6,0xb1,0xa6,0xb8,0xb6,0x7e,0x55,0x71,
|
|
||||||
0xd3,0xf7,0x5b,0xb5,0xce,0xbf,0x41,0xe5,0xcd,0x3f,0xeb,0x71,0x6b,
|
|
||||||
0x63,0x6d,0xb1,0xe5,0xf1,0xfd,0x78,0xe4,0xc7,0x2a,0x9b,0xbf,0xff,
|
|
||||||
0xf1,0xa9,0x9b,0x06,0x15,0xff,0xb7,0xe7,0x04,0xf8,0x68,0x58,0xd5,
|
|
||||||
0xf8,0x49,0xf1,0x90,0x5a,0xa5,0xfa,0xbd,0xd8,0x27,0x1c,0x99,0xcf,
|
|
||||||
0xae,0x43,0xe3,0x51,0xe1,0xaa,0xda,0xec,0xea,0x2d,0x2d,0xaf,0xc9,
|
|
||||||
0xe5,0xfb,0xcd,0xfe,0xf9,0xfc,0xcb,0xe2,0x3b,0x61,0x42,0x36,0x3d,
|
|
||||||
0x2c,0xc8,0x86,0x85,0x43,0xd2,0x91,0x95,0x9e,0xb5,0xd5,0x61,0x5a,
|
|
||||||
0xcb,0x7b,0x1a,0xe9,0xe5,0xe1,0x6b,0xb1,0x67,0x78,0x36,0xde,0x95,
|
|
||||||
0xef,0x61,0xef,0xca,0xe7,0xdf,0x5e,0xd5,0x4e,0xf1,0xe0,0xa4,0x53,
|
|
||||||
0xdc,0x37,0x7c,0xad,0xf6,0x8d,0x7c,0x56,0x1e,0x91,0x9c,0x19,0x9b,
|
|
||||||
0x92,0x5d,0x6b,0xbb,0x85,0xaf,0xd6,0xbe,0x12,0xbe,0x5c,0xbb,0x37,
|
|
||||||
0xbc,0x9c,0x4d,0x0d,0x53,0xf3,0xf9,0x77,0x4f,0xec,0x58,0xed,0x1e,
|
|
||||||
0x7b,0x27,0x47,0xc6,0xdd,0xc2,0x17,0x6b,0xed,0x72,0x7b,0x87,0x5a,
|
|
||||||
0x7c,0xa5,0x3a,0x2e,0x9f,0x7f,0x0f,0x65,0xf7,0x27,0x7b,0xc7,0x73,
|
|
||||||
0x92,0x9e,0xb5,0x6b,0xc3,0xb2,0xf4,0x9e,0x64,0x7c,0x76,0x7f,0xcb,
|
|
||||||
0xb1,0x89,0xf9,0x0c,0x7e,0x28,0x5f,0x37,0x7e,0x23,0x24,0xf5,0x65,
|
|
||||||
0xa5,0x35,0x9b,0xef,0x7f,0x17,0x7f,0x7a,0xc0,0x80,0xf8,0x99,0x64,
|
|
||||||
0xd3,0x9c,0x9b,0xb1,0xe3,0x90,0xb7,0x1a,0xf9,0xe3,0x6b,0x2c,0x2a,
|
|
||||||
0x6c,0xda,0x13,0x6f,0xd0,0x66,0xc6,0xc7,0x86,0x4c,0xde,0x30,0x1b,
|
|
||||||
0x81,0x8f,0xb6,0xf7,0xea,0xe5,0x52,0xa1,0xf6,0xab,0x6a,0xcb,0x3a,
|
|
||||||
0xeb,0xbe,0xda,0x9d,0x61,0x4c,0x6d,0x42,0x58,0x18,0xef,0xaa,0xde,
|
|
||||||
0x9c,0xde,0x96,0xef,0x37,0x1f,0x0d,0xdd,0xf2,0x39,0x35,0x36,0x5d,
|
|
||||||
0x54,0x9d,0x92,0x3d,0x16,0x16,0xa4,0x7d,0xc2,0x49,0xe9,0xd0,0xca,
|
|
||||||
0x80,0xda,0xca,0x30,0x21,0x9d,0x18,0x1e,0x8c,0x17,0x86,0x03,0x63,
|
|
||||||
0x8f,0xf0,0x54,0x3e,0xff,0x46,0xe5,0x97,0xbf,0x33,0x0e,0xad,0x9e,
|
|
||||||
0x1e,0xfb,0x86,0xbe,0xb5,0x8b,0x43,0x23,0xde,0x12,0x0e,0xcf,0xf7,
|
|
||||||
0xca,0x3d,0x6b,0xb7,0x86,0x6a,0xbc,0x20,0x9c,0x5d,0x3b,0x3b,0x0c,
|
|
||||||
0xa9,0xce,0xaf,0xce,0xcd,0xe7,0xe6,0xfd,0xe9,0xe4,0x70,0x55,0xbe,
|
|
||||||
0x36,0xec,0x1c,0xef,0x09,0x3f,0x8d,0x85,0xea,0xb9,0xf1,0x7b,0xd5,
|
|
||||||
0x8b,0x6b,0xa3,0xc2,0x3b,0xe9,0xf4,0xfc,0x36,0xa7,0x86,0xa7,0xb3,
|
|
||||||
0xa1,0x61,0xaf,0x78,0x7a,0xf2,0xdd,0xda,0xbf,0x55,0x1f,0xcc,0xee,
|
|
||||||
0xce,0xf7,0xd9,0x31,0x19,0x90,0xef,0x9b,0x27,0xa6,0x0f,0x86,0x05,
|
|
||||||
0xf9,0x3e,0xbd,0x57,0xb6,0xa8,0xbc,0x66,0xf3,0xcf,0xb6,0xb5,0x7c,
|
|
||||||
0x9f,0xd5,0xe8,0x4f,0x6f,0xfa,0xae,0xab,0x5d,0x26,0xef,0x3a,0xb4,
|
|
||||||
0xf5,0xf1,0xd5,0xfb,0xae,0xff,0x3c,0xdc,0xc6,0x63,0x9f,0x37,0xbd,
|
|
||||||
0x36,0xb8,0xb4,0xb4,0xa5,0x9f,0x77,0x60,0xcb,0x5b,0x9c,0x9d,0x5e,
|
|
||||||
0x9a,0x90,0xef,0x6f,0x9f,0x4f,0x7f,0x1e,0x16,0xe7,0x5e,0x4a,0x17,
|
|
||||||
0x86,0xb1,0xe9,0x0d,0xe1,0xf6,0x7c,0xbf,0xf9,0x48,0x7a,0x63,0xd8,
|
|
||||||
0xb5,0x76,0x78,0x78,0x2e,0x3e,0x15,0x1e,0xcd,0xe6,0x26,0x73,0xf3,
|
|
||||||
0xb5,0xd7,0x25,0xe9,0x99,0x95,0x31,0xf1,0xcd,0x7c,0xfe,0x4d,0x0e,
|
|
||||||
0x53,0xe3,0x77,0xc2,0x71,0xb1,0x67,0x72,0x47,0x9c,0x50,0xbd,0x25,
|
|
||||||
0xb6,0xbc,0x5e,0xf8,0x60,0x78,0x22,0x3e,0x55,0x7d,0x36,0xbe,0x1e,
|
|
||||||
0x7e,0x9d,0xce,0x0e,0xfb,0xc6,0xb3,0x93,0xf3,0x6a,0xff,0xa7,0xba,
|
|
||||||
0x3c,0x5b,0x91,0x2c,0x4b,0x97,0x85,0x5f,0xa5,0x2f,0x85,0x49,0xe9,
|
|
||||||
0xd4,0xd6,0xcf,0xd6,0x9d,0x9c,0xef,0x77,0x8f,0x88,0xef,0x87,0x17,
|
|
||||||
0xf3,0xdb,0x5b,0x94,0x9f,0xff,0x56,0xfa,0x6e,0xf5,0xf1,0xec,0xde,
|
|
||||||
0x64,0x5a,0xf6,0x78,0xb8,0x2f,0xdd,0xab,0x7a,0x54,0x3c,0x32,0x79,
|
|
||||||
0x35,0xbe,0x5a,0x1d,0x9d,0x4e,0xc9,0xe7,0xe5,0x01,0xa1,0x43,0x5c,
|
|
||||||
0x9a,0xdf,0x9f,0x99,0xe1,0x85,0xf4,0x9a,0xd0,0x21,0x9d,0x52,0x59,
|
|
||||||
0xdb,0xbc,0xa6,0xb0,0xe9,0xf8,0x97,0x3f,0xd2,0xf2,0xf9,0xb7,0x96,
|
|
||||||
0xc7,0xd6,0x77,0xe3,0xf1,0xd1,0xf9,0xfe,0x78,0xd3,0x5e,0x79,0xc3,
|
|
||||||
0xf7,0xe1,0x6f,0xe9,0xe7,0x1d,0xd8,0xf2,0xe6,0x64,0x47,0x97,0x17,
|
|
||||||
0xc4,0xd9,0xf9,0x4c,0x9a,0x14,0xc6,0xa5,0x77,0x26,0xa3,0xd2,0x9f,
|
|
||||||
0x85,0x1b,0xd3,0x31,0xf9,0x7e,0x73,0x4a,0x18,0x9f,0x7e,0x27,0xec,
|
|
||||||
0x13,0x8f,0xcf,0xd7,0x65,0x4f,0x84,0xd9,0xd9,0xf3,0xc9,0x94,0xb8,
|
|
||||||
0x6b,0xa8,0xa7,0x47,0x55,0x5e,0x8e,0xcf,0x54,0x27,0xa7,0x0f,0x84,
|
|
||||||
0x71,0xb1,0x43,0xf5,0xe2,0xf4,0x7b,0x95,0x93,0xe2,0xf8,0xea,0xed,
|
|
||||||
0xe9,0xed,0xf9,0x1a,0xf0,0xae,0xf0,0x70,0xf6,0x64,0x98,0x9b,0x7b,
|
|
||||||
0x3c,0x3b,0x29,0x1c,0x9c,0x5e,0x98,0xfc,0x38,0xae,0x0a,0x4f,0x65,
|
|
||||||
0x2f,0x25,0x2f,0x66,0x8b,0xc2,0xfc,0x7c,0x3f,0xfd,0x50,0x3a,0x2d,
|
|
||||||
0x99,0x98,0xc6,0xb0,0x5b,0xad,0x67,0xe8,0x53,0xfb,0x79,0x18,0x9d,
|
|
||||||
0xde,0x97,0x9f,0xf7,0x58,0x3e,0x5f,0x27,0xe5,0x7b,0xec,0x87,0x93,
|
|
||||||
0xe9,0xf5,0x7b,0x92,0xa6,0xf8,0x95,0x70,0x4c,0xed,0xba,0xb0,0x36,
|
|
||||||
0xbd,0x3b,0x99,0x9c,0xce,0x08,0xa5,0xda,0xae,0xd5,0xf6,0xf1,0x85,
|
|
||||||
0xf0,0x5c,0xfa,0x54,0x3e,0x2f,0x67,0xe4,0xb3,0xf0,0x87,0x95,0x35,
|
|
||||||
0xcd,0xab,0x0b,0x9b,0xbe,0xfb,0x65,0xc3,0x1a,0x70,0xe3,0x71,0x7e,
|
|
||||||
0x9f,0xbc,0xe1,0xaa,0x62,0xcb,0xda,0x6f,0xe3,0xcc,0x6b,0x59,0x0f,
|
|
||||||
0xee,0x38,0xbd,0xcd,0x90,0x4d,0x97,0x6d,0xfd,0x7e,0x04,0x7b,0x60,
|
|
||||||
0xf8,0xa8,0x9b,0x92,0x1e,0x52,0xb9,0x26,0x5e,0x15,0x6e,0x8e,0xb7,
|
|
||||||
0x87,0xdb,0xd3,0x5b,0xab,0xb7,0xa4,0x2d,0x3f,0x47,0x87,0x5b,0xd3,
|
|
||||||
0xcb,0x43,0xf7,0x5a,0xbb,0xea,0x49,0xb1,0x4f,0x32,0x2d,0x5f,0x73,
|
|
||||||
0xfd,0x34,0xbd,0xad,0x5a,0xac,0x7d,0x25,0x5c,0x9e,0x5f,0x7e,0x7a,
|
|
||||||
0xbc,0xb2,0x3a,0x22,0x5e,0x16,0x86,0xe5,0xf3,0xf0,0xca,0xec,0xea,
|
|
||||||
0xf2,0xee,0xf1,0xac,0xea,0x15,0xf1,0xfa,0x70,0x53,0x7a,0x73,0xcb,
|
|
||||||
0xf7,0xb7,0x84,0xab,0xd3,0x6a,0xe8,0x1b,0xdb,0x86,0x7e,0xe9,0xd9,
|
|
||||||
0x95,0xe6,0x7c,0x5f,0x7c,0x6b,0x3a,0x36,0xb9,0x3f,0x1b,0x9f,0xaf,
|
|
||||||
0x2b,0xc7,0x86,0x31,0xf1,0xea,0x70,0x61,0xed,0x5f,0xc2,0xc1,0xf1,
|
|
||||||
0xbc,0xe4,0xd0,0x38,0xa2,0xda,0x88,0x3f,0xc9,0x6f,0xef,0x9e,0x7c,
|
|
||||||
0xf6,0x4e,0xcc,0xe7,0xdf,0x98,0x24,0x4d,0x0f,0xad,0xee,0x5a,0xeb,
|
|
||||||
0x13,0x7a,0xd5,0xe6,0x84,0x2b,0xd3,0xe1,0xe1,0x87,0xe9,0x15,0x61,
|
|
||||||
0xef,0xd8,0x14,0xba,0xc7,0x46,0x72,0x4f,0xbc,0x29,0xdc,0x16,0x47,
|
|
||||||
0xe5,0x7b,0xee,0x01,0xc9,0xca,0xfc,0xbe,0x3f,0x3e,0xf2,0x63,0xe5,
|
|
||||||
0xcd,0x67,0xda,0xc6,0xf9,0xb7,0x63,0xf3,0x5b,0xe5,0xdb,0xaf,0xfc,
|
|
||||||
0xf8,0xa6,0x7f,0xfb,0xc4,0x55,0xf5,0xd2,0xa0,0x6b,0xff,0xf0,0x39,
|
|
||||||
0xb8,0x96,0xef,0x4a,0xd8,0xd2,0xcf,0x3b,0xb0,0xe5,0xcd,0xcc,0x7a,
|
|
||||||
0x97,0xbf,0x1e,0xbf,0x1e,0xf6,0xab,0x1d,0x18,0xba,0xc5,0xa3,0xab,
|
|
||||||
0xdd,0x6b,0xdf,0x0d,0xc7,0xd5,0xbe,0x53,0x3d,0xa8,0xf6,0x95,0xea,
|
|
||||||
0xbf,0xc4,0x1f,0x24,0xc3,0xd3,0x4e,0xc9,0x81,0xb5,0x8e,0x61,0xdf,
|
|
||||||
0xda,0x7e,0xe1,0x5f,0xe2,0xb7,0xf3,0x3d,0x6e,0xb7,0xca,0x81,0xb5,
|
|
||||||
0x7d,0xaa,0xfb,0xd6,0xf6,0x0d,0x7b,0xd6,0xbe,0x1e,0xee,0xad,0x2f,
|
|
||||||
0x28,0xfe,0x20,0xdd,0x23,0x69,0x5f,0x3b,0x24,0x1c,0x19,0x8f,0xaa,
|
|
||||||
0x1e,0x11,0x3b,0x57,0xf7,0xa9,0xed,0x9e,0x5f,0xf6,0x9b,0xe1,0xa7,
|
|
||||||
0xd9,0xa0,0x72,0xfb,0xb8,0x6f,0xb5,0x43,0xed,0xc0,0x6a,0xb7,0xd8,
|
|
||||||
0xb5,0xda,0x35,0x76,0xc9,0xaf,0xf7,0x6b,0xd5,0x2f,0xc5,0x2e,0xe1,
|
|
||||||
0xea,0xec,0x9a,0xf2,0x37,0xe3,0xee,0xe1,0x6b,0xb5,0x4e,0xd5,0x23,
|
|
||||||
0x63,0x53,0xf5,0x84,0x78,0x42,0xe8,0x11,0x0f,0xc8,0xf7,0xdb,0x1d,
|
|
||||||
0xc3,0xb0,0x2c,0xa9,0x74,0xae,0x75,0xa9,0xb6,0xaf,0xed,0x13,0x3a,
|
|
||||||
0xe4,0xb7,0xb1,0x7b,0xfa,0xa3,0x4a,0x21,0xb6,0x4f,0x3a,0xd5,0xf6,
|
|
||||||
0xab,0x76,0xac,0x75,0xac,0x7e,0x25,0x0e,0x69,0x9d,0x7f,0x2d,0x6b,
|
|
||||||
0xbc,0x4f,0x3c,0xb1,0xcb,0xe0,0x96,0xe3,0xfa,0x3e,0x7e,0xf9,0x86,
|
|
||||||
0xf7,0x3f,0x5a,0x8f,0xf1,0x5b,0x5b,0xee,0xb2,0xf1,0xff,0xfe,0x58,
|
|
||||||
0xfc,0xe9,0x01,0x7d,0xeb,0x6b,0x4b,0x2d,0x97,0xdd,0x69,0x7e,0x9b,
|
|
||||||
0x41,0x2d,0xa7,0xbb,0xa4,0xb7,0x57,0xb6,0xf4,0xf3,0x0e,0x6c,0x79,
|
|
||||||
0x8b,0xea,0xa3,0x8a,0x49,0x76,0x7e,0xe5,0xbb,0xe9,0x09,0x49,0x8f,
|
|
||||||
0x78,0x4c,0x72,0x74,0x3c,0x3c,0x39,0x2c,0x76,0x49,0x7a,0xc5,0xd3,
|
|
||||||
0x2a,0x83,0xb3,0xbb,0xca,0xa3,0xb3,0xf3,0xcb,0xdf,0x4f,0xcf,0xab,
|
|
||||||
0x9c,0x9a,0xf6,0x4a,0x8e,0x49,0x07,0x55,0x66,0x64,0x23,0x4a,0x17,
|
|
||||||
0xa7,0x83,0x2b,0x03,0xd3,0xb3,0x2a,0x7d,0xf3,0xd3,0x4f,0x35,0x56,
|
|
||||||
0x14,0xa6,0x64,0xc5,0xf2,0xf1,0xf1,0xa8,0xa4,0x73,0x3c,0x28,0x74,
|
|
||||||
0x8e,0x47,0x87,0xde,0xf1,0xfc,0x4a,0x23,0xbb,0xb9,0xfc,0x68,0x76,
|
|
||||||
0x5d,0xe9,0xbc,0xf4,0xf4,0xfc,0x6f,0x4f,0xad,0xf4,0x8e,0xdd,0x93,
|
|
||||||
0x23,0xd3,0x63,0x92,0xde,0x69,0xcf,0xe4,0xdc,0xf4,0xb2,0xf2,0xfd,
|
|
||||||
0xf5,0xdb,0x4b,0xf5,0xac,0x54,0xfe,0x5e,0x7a,0x5c,0xf2,0xed,0x78,
|
|
||||||
0x50,0xd2,0x29,0x7e,0x2b,0xff,0xdb,0xee,0xc9,0x59,0xf9,0x7a,0x72,
|
|
||||||
0x5e,0xfd,0xe6,0xd2,0xd9,0xe9,0xf7,0x2b,0x7d,0xb3,0x61,0x95,0x62,
|
|
||||||
0x36,0xb4,0x92,0xd5,0x67,0x97,0xc6,0x64,0x17,0x94,0xfb,0xa7,0x03,
|
|
||||||
0x2a,0xa7,0xa5,0x4d,0x95,0xde,0xf9,0x3c,0x7c,0xb7,0x79,0x79,0x61,
|
|
||||||
0x79,0xf3,0xaa,0x42,0x16,0x77,0xad,0xec,0x50,0xeb,0x50,0xfd,0x71,
|
|
||||||
0xf3,0x8e,0x95,0x3f,0x1c,0xfb,0xb7,0xb6,0xb8,0xc3,0xf4,0xb6,0x43,
|
|
||||||
0x37,0x7e,0x27,0xfe,0xa2,0xc6,0xfa,0xc7,0x3a,0x28,0x7e,0x26,0xd9,
|
|
||||||
0x21,0xf6,0x0d,0x1b,0x4f,0x03,0x1f,0x6d,0xef,0x36,0xbf,0x5d,0x78,
|
|
||||||
0xa5,0xf1,0x4c,0xf1,0xc9,0xc6,0x93,0xc5,0x99,0x8d,0x27,0x72,0x0f,
|
|
||||||
0x95,0xa6,0xd5,0x1f,0x2a,0x3d,0xd1,0x98,0x57,0x7c,0xb6,0xf1,0x72,
|
|
||||||
0x71,0x61,0x63,0x76,0xf1,0xf1,0xfc,0xf7,0x59,0xf5,0x07,0x4a,0x53,
|
|
||||||
0xea,0x8f,0x97,0xde,0x6e,0xbc,0x5c,0x58,0xd8,0x78,0x21,0x3f,0xff,
|
|
||||||
0xd1,0xfc,0x6f,0x16,0x14,0x97,0x36,0xaf,0x2e,0x2c,0x6d,0x2c,0x2c,
|
|
||||||
0xcc,0xaa,0x3f,0x58,0x9a,0xdc,0x98,0x54,0x9a,0x98,0xff,0x9c,0xd9,
|
|
||||||
0x78,0xb6,0xb8,0xb8,0x79,0x69,0xe1,0xcd,0xc6,0xc2,0xe2,0xbc,0xc6,
|
|
||||||
0xe3,0xb9,0x79,0xc5,0xc7,0x1a,0x0f,0x97,0x1e,0xaa,0x3f,0x5c,0x9a,
|
|
||||||
0xd1,0x78,0xa4,0x34,0x37,0xff,0xf7,0xf9,0xf9,0xed,0x3d,0x93,0x5f,
|
|
||||||
0xff,0xbc,0xc6,0xcc,0xe2,0x03,0xf5,0x49,0xa5,0x71,0x8d,0xfb,0x4a,
|
|
||||||
0x93,0x1a,0xd3,0x4b,0xf3,0x1a,0xaf,0x17,0x57,0x36,0x9e,0x2f,0x3c,
|
|
||||||
0x91,0xff,0xdd,0xec,0xc6,0x2b,0xc5,0x57,0xf3,0xcb,0xbc,0xd6,0xbc,
|
|
||||||
0xac,0xf8,0x72,0xe3,0xe9,0xfc,0xf2,0xcf,0xe5,0xf7,0xe3,0xa1,0xd2,
|
|
||||||
0x43,0xf9,0xfd,0xfd,0x65,0xf3,0xbb,0xb9,0x95,0x85,0x49,0x59,0x53,
|
|
||||||
0x79,0xe7,0x45,0x9f,0x1d,0xd8,0xe5,0x9a,0x9d,0xca,0x1b,0xbf,0x07,
|
|
||||||
0x75,0x61,0x7e,0xbb,0xad,0x9f,0x8d,0x6b,0xf9,0x4e,0xfc,0x91,0x3f,
|
|
||||||
0xb6,0xd6,0x03,0xfe,0xbf,0xd6,0xfc,0x8f,0xff,0xfe,0x7e,0x61,0x55,
|
|
||||||
0xf3,0x9a,0xd6,0xcb,0xac,0x69,0xfd,0x3f,0x81,0xdf,0xff,0xc0,0xbf,
|
|
||||||
0xad,0x3f,0x7f,0xcd,0x1f,0x5d,0xdf,0x9a,0xcd,0x7e,0x5f,0xfd,0xdf,
|
|
||||||
0x5e,0xef,0xf2,0x7c,0xa6,0xad,0xde,0xec,0xbc,0xd5,0x1f,0xb8,0x9e,
|
|
||||||
0xd5,0xff,0xcf,0xf5,0xae,0xde,0xec,0x3a,0x57,0xb7,0x6a,0xb9,0x3f,
|
|
||||||
0x6b,0x0a,0x4d,0x77,0xaf,0xff,0x0e,0x98,0x9d,0xe7,0x7e,0x7a,0xd0,
|
|
||||||
0xa6,0xd7,0xf6,0x1a,0x33,0xd6,0x1f,0x1b,0xb3,0x70,0xa7,0x4b,0x06,
|
|
||||||
0xb5,0xec,0x7d,0xb7,0x82,0xe7,0x19,0xe0,0xaf,0x6a,0xe3,0x9c,0xdb,
|
|
||||||
0xec,0xd8,0x97,0x4f,0x5c,0x7d,0x7b,0x69,0x6d,0xe3,0xad,0x42,0xcb,
|
|
||||||
0xfb,0xbd,0x3b,0x5d,0xfb,0xfd,0xf2,0x16,0xbf,0x8f,0x00,0x7f,0x23,
|
|
||||||
0x1f,0xf8,0x7c,0x47,0xeb,0xf7,0xc0,0xac,0x5f,0xef,0xb5,0xbc,0xd6,
|
|
||||||
0x67,0xed,0x07,0x6c,0xcf,0x7e,0x9c,0x76,0xa8,0xb4,0x7e,0xee,0x77,
|
|
||||||
0xed,0x2e,0x17,0x7d,0xf2,0x86,0xb3,0x4a,0x8f,0x3b,0xae,0x0f,0xd8,
|
|
||||||
0x60,0x4d,0xeb,0xeb,0x77,0xdb,0xb1,0xc6,0xdb,0x85,0xef,0xc7,0x1d,
|
|
||||||
0xc2,0x0e,0xb5,0x2f,0x55,0x63,0x7d,0x4d,0x69,0x8b,0xdf,0x1f,0x80,
|
|
||||||
0xbf,0xbb,0xf7,0x0b,0x2b,0xb6,0xf8,0x7d,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xc3,0x5a,0xbd,0xe9,
|
|
||||||
0xfb,0xf2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x60,0xab,0x32,0x0c,0x00,0x00,0x00,0xb6,0x77,0xef,0x37,
|
|
||||||
0xbf,0x5f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb6,
|
|
||||||
0x31,0xc3,0xdf,0x1f,0x06,0x00,0x00,0x00,0xdb,0xbd,0x66,0x00,0x00,
|
|
||||||
0x00,0xd8,0xfe,0xad,0x6a,0x5e,0x55,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0xd8,0xae,0x0c,0x5f,0x35,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0xd8,0xb6,0xac,0x1c,0xbe,0xb2,0x00,0x00,0xc0,0x47,0xca,
|
|
||||||
0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0xd8,0xda,0xac,0x18,0xbe,0x02,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x8b,0x7a,0x6f,
|
|
||||||
0xf8,0x7b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0xc0,0x56,0x62,0xf9,0xf0,0xe5,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x56,0x62,
|
|
||||||
0xd9,0x88,0x65,0x00,0x1f,0x4d,0xc3,0x01,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x80,0x6d,0xd0,0x50,0x00,0x00,0x00,0xd8,0xde,0xfd,
|
|
||||||
0x72,0xc4,0x2f,0x87,0x01,0x00,0x00,0x00,0x00,0x00,0x6c,0x57,0x86,
|
|
||||||
0x03,0x7c,0x64,0x0d,0x05,0x00,0x00,0x00,0x00,0x00,0xd8,0x9e,0xbc,
|
|
||||||
0x3b,0xe2,0xdd,0x61,0x00,0x00,0x00,0x00,0xc0,0x76,0x6b,0x28,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0xc0,0x76,0x65,0x38,0x00,0x00,0x00,0x6c,0xff,
|
|
||||||
0xde,0x19,0xf1,0xce,0x30,0x80,0x8f,0xa8,0xa1,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdb,0x82,0xa5,0x23,0x96,0x02,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x13,0xde,
|
|
||||||
0x1e,0xf1,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,
|
|
||||||
0x8d,0x59,0x32,0x62,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0xc0,0x36,0xe1,0xad,0x4b,0xdf,0x02,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x60,0x7b,0x30,0x02,0x00,0x00,0x00,0xb6,0x7f,0x6f,0x5e,
|
|
||||||
0xfa,0x26,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,
|
|
||||||
0xb6,0x62,0x08,0x00,0x00,0x00,0x6c,0xef,0xde,0xb8,0xf4,0x8d,0xa1,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0xdb,0x99,0x21,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdb,0x82,0xd7,0x2f,0x7d,0x1d,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x9b,0xf0,
|
|
||||||
0x8b,0x4b,0x7f,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0xc0,0x56,0x6c,0xf1,0xa5,0x8b,0x01,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x80,0x6d,0xcf,0x60,0x00,0x00,0x00,0x00,0x60,
|
|
||||||
0xfb,0xf4,0xf3,0x91,0x3f,0x1f,0x02,0xf0,0x91,0x74,0x29,0x00,0x00,
|
|
||||||
0x00,0x00,0xb0,0x1d,0x1b,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0xdb,0xaa,0xd7,0x46,0xbe,0x36,0x04,0x00,0x80,0x8f,0x94,0xc1,
|
|
||||||
0x00,0x00,0x00,0xb0,0xdd,0xbb,0x14,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0xb6,0x5d,0xaf,0x8e,0x7c,0x15,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd8,0x4a,0xbc,0x32,
|
|
||||||
0xf2,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x80,0x2d,0xea,0xe5,0x91,0x2f,0x03,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x6c,0x51,0x2f,0x8d,0x7c,0x09,0x00,0x80,0x8f,0x92,0xcb,0x00,0x00,
|
|
||||||
0x00,0x00,0x80,0xed,0xd6,0x96,0x7e,0xfd,0x11,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0xfe,0x32,0x83,0x00,0x3e,0x8a,0x5e,0xbc,0xec,
|
|
||||||
0xc5,0xc1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x6c,0xd5,0x06,0x01,0x7c,0x24,0x8d,0x04,0x00,0x00,0x00,0x00,
|
|
||||||
0xb6,0x57,0x8b,0x2e,0x5b,0x34,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x80,0xed,0xc2,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0xb6,0x5e,0x2f,0x5c,0xf6,0xc2,0x60,0x00,0x00,0x00,
|
|
||||||
0xf8,0x08,0x18,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x25,0x3d,0x7f,0xd9,0xf3,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0xf0,0x77,0xf3,0xdc,0x65,0xcf,0x01,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x7f,0x63,0x0b,0x2f,0x5b,0x08,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xb1,0x1d,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,
|
|
||||||
0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,
|
|
||||||
0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,
|
|
||||||
0x92,0x24,0x49,0x92,0x24,0x49,0x7f,0x97,0xfe,0x2f,0x91,0x73,0x60,
|
|
||||||
0x14,0x14
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
BIN
source/ngc/images/icon_home.png
Normal file
After Width: | Height: | Size: 294 B |
BIN
source/ngc/images/icon_settings.png
Normal file
After Width: | Height: | Size: 434 B |
BIN
source/ngc/images/keyboard_key.png
Normal file
After Width: | Height: | Size: 613 B |
BIN
source/ngc/images/keyboard_key_over.png
Normal file
After Width: | Height: | Size: 587 B |
BIN
source/ngc/images/keyboard_largekey.png
Normal file
After Width: | Height: | Size: 705 B |
BIN
source/ngc/images/keyboard_largekey_over.png
Normal file
After Width: | Height: | Size: 685 B |
BIN
source/ngc/images/keyboard_mediumkey.png
Normal file
After Width: | Height: | Size: 654 B |
BIN
source/ngc/images/keyboard_mediumkey_over.png
Normal file
After Width: | Height: | Size: 639 B |
BIN
source/ngc/images/keyboard_textbox.png
Normal file
After Width: | Height: | Size: 749 B |
BIN
source/ngc/images/player1_grab.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
source/ngc/images/player1_point.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
source/ngc/images/player2_grab.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
source/ngc/images/player2_point.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
source/ngc/images/player3_grab.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
source/ngc/images/player3_point.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
source/ngc/images/player4_grab.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
source/ngc/images/player4_point.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
source/ngc/images/progressbar.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
source/ngc/images/progressbar_empty.png
Normal file
After Width: | Height: | Size: 279 B |
BIN
source/ngc/images/progressbar_outline.png
Normal file
After Width: | Height: | Size: 888 B |
BIN
source/ngc/images/screen_position.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
source/ngc/images/scrollbar.png
Normal file
After Width: | Height: | Size: 270 B |
BIN
source/ngc/images/scrollbar_arrowdown.png
Normal file
After Width: | Height: | Size: 721 B |
BIN
source/ngc/images/scrollbar_arrowdown_over.png
Normal file
After Width: | Height: | Size: 733 B |
BIN
source/ngc/images/scrollbar_arrowup.png
Normal file
After Width: | Height: | Size: 700 B |
BIN
source/ngc/images/scrollbar_arrowup_over.png
Normal file
After Width: | Height: | Size: 739 B |
BIN
source/ngc/images/scrollbar_box.png
Normal file
After Width: | Height: | Size: 481 B |
BIN
source/ngc/images/scrollbar_box_over.png
Normal file
After Width: | Height: | Size: 469 B |
BIN
source/ngc/images/throbber.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
@ -32,10 +32,20 @@
|
|||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
|
int rumbleRequest[4] = {0,0,0,0};
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
static int rumbleCount[4] = {0,0,0,0};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// hold superscope/mouse/justifier cursor positions
|
||||||
|
static int cursor_x[5] = {0,0,0,0,0};
|
||||||
|
static int cursor_y[5] = {0,0,0,0,0};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Controller Functions
|
* Controller Functions
|
||||||
*
|
*
|
||||||
* The following map the NGC Pads to the *NEW* controller system.
|
* The following map the Wii controls to the Snes9x controller system
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ASSIGN_BUTTON_TRUE( keycode, snescmd ) \
|
#define ASSIGN_BUTTON_TRUE( keycode, snescmd ) \
|
||||||
S9xMapButton( keycode, cmd = S9xGetCommandT(snescmd), true)
|
S9xMapButton( keycode, cmd = S9xGetCommandT(snescmd), true)
|
||||||
@ -44,119 +54,151 @@
|
|||||||
S9xMapButton( keycode, cmd = S9xGetCommandT(snescmd), false)
|
S9xMapButton( keycode, cmd = S9xGetCommandT(snescmd), false)
|
||||||
|
|
||||||
int scopeTurbo = 0; // tracks whether superscope turbo is on or off
|
int scopeTurbo = 0; // tracks whether superscope turbo is on or off
|
||||||
unsigned int gcpadmap[12]; // Gamecube controller Padmap
|
u32 btnmap[4][4][12]; // button mapping
|
||||||
unsigned int wmpadmap[12]; // Wiimote Padmap
|
|
||||||
unsigned int ccpadmap[12]; // Classic Controller Padmap
|
|
||||||
unsigned int ncpadmap[12]; // Nunchuk + wiimote Padmap
|
|
||||||
unsigned int gcscopemap[6]; // Superscope : GC controller button mapping
|
|
||||||
unsigned int wmscopemap[6]; // Superscope : wiimote button mapping
|
|
||||||
unsigned int gcmousemap[2]; // Mouse : GC controller button mapping
|
|
||||||
unsigned int wmmousemap[2]; // Mouse : wiimote button mapping
|
|
||||||
unsigned int gcjustmap[3]; // Justifier : GC controller button mapping
|
|
||||||
unsigned int wmjustmap[3]; // Justifier : wiimote button mapping
|
|
||||||
|
|
||||||
void ResetControls()
|
void ResetControls()
|
||||||
{
|
{
|
||||||
|
memset(btnmap, 0, sizeof(btnmap));
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
/*** Gamecube controller Padmap ***/
|
/*** Gamecube controller Padmap ***/
|
||||||
i=0;
|
i=0;
|
||||||
gcpadmap[i++] = PAD_BUTTON_A;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||||
gcpadmap[i++] = PAD_BUTTON_B;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||||
gcpadmap[i++] = PAD_BUTTON_X;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_X;
|
||||||
gcpadmap[i++] = PAD_BUTTON_Y;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_Y;
|
||||||
gcpadmap[i++] = PAD_TRIGGER_L;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_L;
|
||||||
gcpadmap[i++] = PAD_TRIGGER_R;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_R;
|
||||||
gcpadmap[i++] = PAD_TRIGGER_Z;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
|
||||||
gcpadmap[i++] = PAD_BUTTON_START;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z;
|
||||||
gcpadmap[i++] = PAD_BUTTON_UP;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_UP;
|
||||||
gcpadmap[i++] = PAD_BUTTON_DOWN;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_DOWN;
|
||||||
gcpadmap[i++] = PAD_BUTTON_LEFT;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_LEFT;
|
||||||
gcpadmap[i++] = PAD_BUTTON_RIGHT;
|
btnmap[CTRL_PAD][CTRLR_GCPAD][i++] = PAD_BUTTON_RIGHT;
|
||||||
|
|
||||||
/*** Wiimote Padmap ***/
|
/*** Wiimote Padmap ***/
|
||||||
i=0;
|
i=0;
|
||||||
wmpadmap[i++] = WPAD_BUTTON_B;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||||
wmpadmap[i++] = WPAD_BUTTON_2;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_2;
|
||||||
wmpadmap[i++] = WPAD_BUTTON_1;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_1;
|
||||||
wmpadmap[i++] = WPAD_BUTTON_A;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||||
wmpadmap[i++] = 0x0000;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0x0000;
|
||||||
wmpadmap[i++] = 0x0000;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = 0x0000;
|
||||||
wmpadmap[i++] = WPAD_BUTTON_MINUS;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
|
||||||
wmpadmap[i++] = WPAD_BUTTON_PLUS;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS;
|
||||||
wmpadmap[i++] = WPAD_BUTTON_RIGHT;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_RIGHT;
|
||||||
wmpadmap[i++] = WPAD_BUTTON_LEFT;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_LEFT;
|
||||||
wmpadmap[i++] = WPAD_BUTTON_UP;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_UP;
|
||||||
wmpadmap[i++] = WPAD_BUTTON_DOWN;
|
btnmap[CTRL_PAD][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN;
|
||||||
|
|
||||||
/*** Classic Controller Padmap ***/
|
/*** Classic Controller Padmap ***/
|
||||||
i=0;
|
i=0;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_A;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_A;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_B;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_B;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_X;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_X;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_Y;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_Y;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_FULL_L;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_L;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_FULL_R;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_FULL_R;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_MINUS;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_PLUS;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_PLUS;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_MINUS;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_UP;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_UP;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_DOWN;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_DOWN;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_LEFT;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_LEFT;
|
||||||
ccpadmap[i++] = WPAD_CLASSIC_BUTTON_RIGHT;
|
btnmap[CTRL_PAD][CTRLR_CLASSIC][i++] = WPAD_CLASSIC_BUTTON_RIGHT;
|
||||||
|
|
||||||
/*** Nunchuk + wiimote Padmap ***/
|
/*** Nunchuk + wiimote Padmap ***/
|
||||||
i=0;
|
i=0;
|
||||||
ncpadmap[i++] = WPAD_BUTTON_A;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_A;
|
||||||
ncpadmap[i++] = WPAD_BUTTON_B;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_B;
|
||||||
ncpadmap[i++] = WPAD_NUNCHUK_BUTTON_C;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_C;
|
||||||
ncpadmap[i++] = WPAD_NUNCHUK_BUTTON_Z;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_NUNCHUK_BUTTON_Z;
|
||||||
ncpadmap[i++] = WPAD_BUTTON_2;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_2;
|
||||||
ncpadmap[i++] = WPAD_BUTTON_1;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_1;
|
||||||
ncpadmap[i++] = WPAD_BUTTON_MINUS;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_PLUS;
|
||||||
ncpadmap[i++] = WPAD_BUTTON_PLUS;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_MINUS;
|
||||||
ncpadmap[i++] = WPAD_BUTTON_UP;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_UP;
|
||||||
ncpadmap[i++] = WPAD_BUTTON_DOWN;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_DOWN;
|
||||||
ncpadmap[i++] = WPAD_BUTTON_LEFT;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_LEFT;
|
||||||
ncpadmap[i++] = WPAD_BUTTON_RIGHT;
|
btnmap[CTRL_PAD][CTRLR_NUNCHUK][i++] = WPAD_BUTTON_RIGHT;
|
||||||
|
|
||||||
/*** Superscope : GC controller button mapping ***/
|
/*** Superscope : GC controller button mapping ***/
|
||||||
i=0;
|
i=0;
|
||||||
gcscopemap[i++] = PAD_TRIGGER_Z;
|
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||||
gcscopemap[i++] = PAD_BUTTON_B;
|
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||||
gcscopemap[i++] = PAD_BUTTON_A;
|
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z;
|
||||||
gcscopemap[i++] = PAD_BUTTON_Y;
|
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_Y;
|
||||||
gcscopemap[i++] = PAD_BUTTON_X;
|
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_X;
|
||||||
gcscopemap[i++] = PAD_BUTTON_START;
|
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
|
||||||
|
|
||||||
/*** Superscope : wiimote button mapping ***/
|
/*** Superscope : wiimote button mapping ***/
|
||||||
i=0;
|
i=0;
|
||||||
wmscopemap[i++] = WPAD_BUTTON_MINUS;
|
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||||
wmscopemap[i++] = WPAD_BUTTON_B;
|
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||||
wmscopemap[i++] = WPAD_BUTTON_A;
|
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS;
|
||||||
wmscopemap[i++] = WPAD_BUTTON_UP;
|
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_UP;
|
||||||
wmscopemap[i++] = WPAD_BUTTON_DOWN;
|
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN;
|
||||||
wmscopemap[i++] = WPAD_BUTTON_PLUS;
|
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
|
||||||
|
|
||||||
/*** Mouse : GC controller button mapping ***/
|
/*** Mouse : GC controller button mapping ***/
|
||||||
i=0;
|
i=0;
|
||||||
gcmousemap[i++] = PAD_BUTTON_A;
|
btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||||
gcmousemap[i++] = PAD_BUTTON_B;
|
btnmap[CTRL_MOUSE][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||||
|
|
||||||
/*** Mouse : wiimote button mapping ***/
|
/*** Mouse : wiimote button mapping ***/
|
||||||
i=0;
|
i=0;
|
||||||
wmmousemap[i++] = WPAD_BUTTON_A;
|
btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||||
wmmousemap[i++] = WPAD_BUTTON_B;
|
btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||||
|
|
||||||
/*** Justifier : GC controller button mapping ***/
|
/*** Justifier : GC controller button mapping ***/
|
||||||
i=0;
|
i=0;
|
||||||
gcjustmap[i++] = PAD_BUTTON_A;
|
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
|
||||||
gcjustmap[i++] = PAD_BUTTON_B;
|
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_A;
|
||||||
gcjustmap[i++] = PAD_BUTTON_START;
|
btnmap[CTRL_JUST][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
|
||||||
|
|
||||||
/*** Justifier : wiimote button mapping ***/
|
/*** Justifier : wiimote button mapping ***/
|
||||||
i=0;
|
i=0;
|
||||||
wmjustmap[i++] = WPAD_BUTTON_A;
|
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
|
||||||
wmjustmap[i++] = WPAD_BUTTON_B;
|
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
|
||||||
wmjustmap[i++] = WPAD_BUTTON_PLUS;
|
btnmap[CTRL_JUST][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* ShutoffRumble
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
void ShutoffRumble()
|
||||||
|
{
|
||||||
|
for(int i=0;i<4;i++)
|
||||||
|
{
|
||||||
|
WPAD_Rumble(i, 0);
|
||||||
|
rumbleCount[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* DoRumble
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
void DoRumble(int i)
|
||||||
|
{
|
||||||
|
if(rumbleRequest[i] && rumbleCount[i] < 3)
|
||||||
|
{
|
||||||
|
WPAD_Rumble(i, 1); // rumble on
|
||||||
|
rumbleCount[i]++;
|
||||||
|
}
|
||||||
|
else if(rumbleRequest[i])
|
||||||
|
{
|
||||||
|
rumbleCount[i] = 12;
|
||||||
|
rumbleRequest[i] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(rumbleCount[i])
|
||||||
|
rumbleCount[i]--;
|
||||||
|
WPAD_Rumble(i, 0); // rumble off
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -212,9 +254,7 @@ s8 WPAD_Stick(u8 chan, u8 right, int axis)
|
|||||||
return (s8)(val * 128.0f);
|
return (s8)(val * 128.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hold superscope/mouse/justifier cursor positions
|
#endif
|
||||||
static int cursor_x[5] = {0,0,0,0,0};
|
|
||||||
static int cursor_y[5] = {0,0,0,0,0};
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* UpdateCursorPosition
|
* UpdateCursorPosition
|
||||||
@ -407,11 +447,11 @@ void decodepad (int pad)
|
|||||||
/*** Report pressed buttons (gamepads) ***/
|
/*** Report pressed buttons (gamepads) ***/
|
||||||
for (i = 0; i < MAXJP; i++)
|
for (i = 0; i < MAXJP; i++)
|
||||||
{
|
{
|
||||||
if ( (jp & gcpadmap[i]) // gamecube controller
|
if ( (jp & btnmap[CTRL_PAD][CTRLR_GCPAD][i]) // gamecube controller
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|| ( (exp_type == WPAD_EXP_NONE) && (wp & wmpadmap[i]) ) // wiimote
|
|| ( (exp_type == WPAD_EXP_NONE) && (wp & btnmap[CTRL_PAD][CTRLR_WIIMOTE][i]) ) // wiimote
|
||||||
|| ( (exp_type == WPAD_EXP_CLASSIC) && (wp & ccpadmap[i]) ) // classic controller
|
|| ( (exp_type == WPAD_EXP_CLASSIC) && (wp & btnmap[CTRL_PAD][CTRLR_CLASSIC][i]) ) // classic controller
|
||||||
|| ( (exp_type == WPAD_EXP_NUNCHUK) && (wp & ncpadmap[i]) ) // nunchuk + wiimote
|
|| ( (exp_type == WPAD_EXP_NUNCHUK) && (wp & btnmap[CTRL_PAD][CTRLR_NUNCHUK][i]) ) // nunchuk + wiimote
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
S9xReportButton (offset + i, true);
|
S9xReportButton (offset + i, true);
|
||||||
@ -420,15 +460,15 @@ void decodepad (int pad)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*** Superscope ***/
|
/*** Superscope ***/
|
||||||
if (Settings.SuperScopeMaster && pad == GCSettings.Superscope - 1) // report only once
|
if (Settings.SuperScopeMaster && pad == 0) // report only once
|
||||||
{
|
{
|
||||||
// buttons
|
// buttons
|
||||||
offset = 0x50;
|
offset = 0x50;
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
if (jp & gcscopemap[i]
|
if (jp & btnmap[CTRL_SCOPE][CTRLR_GCPAD][i]
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|| wp & wmscopemap[i]
|
|| wp & btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i]
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -457,15 +497,15 @@ void decodepad (int pad)
|
|||||||
S9xReportPointer(offset, (u16) cursor_x[0], (u16) cursor_y[0]);
|
S9xReportPointer(offset, (u16) cursor_x[0], (u16) cursor_y[0]);
|
||||||
}
|
}
|
||||||
/*** Mouse ***/
|
/*** Mouse ***/
|
||||||
else if (Settings.MouseMaster && pad < GCSettings.Mouse)
|
else if (Settings.MouseMaster && pad == 0)
|
||||||
{
|
{
|
||||||
// buttons
|
// buttons
|
||||||
offset = 0x60 + (2 * pad);
|
offset = 0x60 + (2 * pad);
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (jp & gcmousemap[i]
|
if (jp & btnmap[CTRL_MOUSE][CTRLR_GCPAD][i]
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|| wp & wmmousemap[i]
|
|| wp & btnmap[CTRL_MOUSE][CTRLR_WIIMOTE][i]
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
S9xReportButton(offset + i, true);
|
S9xReportButton(offset + i, true);
|
||||||
@ -479,15 +519,15 @@ void decodepad (int pad)
|
|||||||
(u16) cursor_y[1 + pad]);
|
(u16) cursor_y[1 + pad]);
|
||||||
}
|
}
|
||||||
/*** Justifier ***/
|
/*** Justifier ***/
|
||||||
else if (Settings.JustifierMaster && pad < GCSettings.Justifier)
|
else if (Settings.JustifierMaster && pad < 2)
|
||||||
{
|
{
|
||||||
// buttons
|
// buttons
|
||||||
offset = 0x70 + (3 * pad);
|
offset = 0x70 + (3 * pad);
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
if (jp & gcjustmap[i]
|
if (jp & btnmap[CTRL_JUST][CTRLR_GCPAD][i]
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|| wp & wmjustmap[i]
|
|| wp & btnmap[CTRL_JUST][CTRLR_WIIMOTE][i]
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
S9xReportButton(offset + i, true);
|
S9xReportButton(offset + i, true);
|
||||||
@ -500,7 +540,7 @@ void decodepad (int pad)
|
|||||||
S9xReportPointer(offset + pad, (u16) cursor_x[3 + pad],
|
S9xReportPointer(offset + pad, (u16) cursor_x[3 + pad],
|
||||||
(u16) cursor_y[3 + pad]);
|
(u16) cursor_y[3 + pad]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
// screenshot (temp)
|
// screenshot (temp)
|
||||||
if (wp & CLASSIC_CTRL_BUTTON_ZR)
|
if (wp & CLASSIC_CTRL_BUTTON_ZR)
|
||||||
@ -519,28 +559,14 @@ void decodepad (int pad)
|
|||||||
void NGCReportButtons ()
|
void NGCReportButtons ()
|
||||||
{
|
{
|
||||||
s8 gc_px = PAD_SubStickX (0);
|
s8 gc_px = PAD_SubStickX (0);
|
||||||
s8 gc_py = PAD_SubStickY (0);
|
|
||||||
|
|
||||||
u16 gc_pb = PAD_ButtonsHeld (0);
|
u16 gc_pb = PAD_ButtonsHeld (0);
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
s8 wm_sx = WPAD_Stick (0,1,0);
|
s8 wm_sx = WPAD_Stick (0,1,0);
|
||||||
s8 wm_sy = WPAD_Stick (0,1,1);
|
u32 wm_pb = WPAD_ButtonsDown (0); // wiimote / expansion button info
|
||||||
u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote / expansion button info
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*** Check for video zoom ***/
|
|
||||||
if (GCSettings.Zoom)
|
|
||||||
{
|
|
||||||
if (gc_py < -36 || gc_py > 36)
|
|
||||||
zoom ((float) gc_py / -36);
|
|
||||||
#ifdef HW_RVL
|
|
||||||
if (wm_sy < -36 || wm_sy > 36)
|
|
||||||
zoom ((float) wm_sy / -36);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings.TurboMode = ( (gc_px > 70)
|
Settings.TurboMode = ( (gc_px > 70)
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|| (wm_sx > 70)
|
|| (wm_sx > 70)
|
||||||
@ -589,18 +615,12 @@ void SetControllers ()
|
|||||||
else if (Settings.MouseMaster == true)
|
else if (Settings.MouseMaster == true)
|
||||||
{
|
{
|
||||||
S9xSetController (0, CTL_MOUSE, 0, 0, 0, 0);
|
S9xSetController (0, CTL_MOUSE, 0, 0, 0, 0);
|
||||||
if (GCSettings.Mouse == 2)
|
S9xSetController (1, CTL_JOYPAD, 1, 0, 0, 0);
|
||||||
S9xSetController (1, CTL_MOUSE, 1, 0, 0, 0);
|
|
||||||
else
|
|
||||||
S9xSetController (1, CTL_JOYPAD, 1, 0, 0, 0);
|
|
||||||
}
|
}
|
||||||
else if (Settings.JustifierMaster == true)
|
else if (Settings.JustifierMaster == true)
|
||||||
{
|
{
|
||||||
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||||
if(GCSettings.Justifier == 2)
|
S9xSetController(1, CTL_JUSTIFIER, 1, 0, 0, 0);
|
||||||
S9xSetController(1, CTL_JUSTIFIER, 1, 0, 0, 0);
|
|
||||||
else
|
|
||||||
S9xSetController(1, CTL_JUSTIFIER, 0, 0, 0, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -625,8 +645,8 @@ void SetDefaultButtonMap ()
|
|||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Y");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Y");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 L");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 L");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 R");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 R");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Select");
|
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Start");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Start");
|
||||||
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Select");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Up");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Up");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Down");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Down");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Left");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad1 Left");
|
||||||
@ -640,8 +660,8 @@ void SetDefaultButtonMap ()
|
|||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Y");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Y");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 L");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 L");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 R");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 R");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Select");
|
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Start");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Start");
|
||||||
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Select");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Up");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Up");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Down");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Down");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Left");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad2 Left");
|
||||||
@ -655,8 +675,8 @@ void SetDefaultButtonMap ()
|
|||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Y");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Y");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 L");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 L");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 R");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 R");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Select");
|
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Start");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Start");
|
||||||
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Select");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Up");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Up");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Down");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Down");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Left");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad3 Left");
|
||||||
@ -670,8 +690,8 @@ void SetDefaultButtonMap ()
|
|||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Y");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Y");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 L");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 L");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 R");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 R");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Select");
|
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Start");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Start");
|
||||||
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Select");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Up");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Up");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Down");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Down");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Left");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Joypad4 Left");
|
||||||
@ -679,8 +699,8 @@ void SetDefaultButtonMap ()
|
|||||||
|
|
||||||
maxcode = 0x50;
|
maxcode = 0x50;
|
||||||
/*** Superscope ***/
|
/*** Superscope ***/
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope AimOffscreen");
|
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Fire");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Fire");
|
||||||
|
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope AimOffscreen");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Cursor");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Cursor");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo");
|
||||||
@ -695,11 +715,11 @@ void SetDefaultButtonMap ()
|
|||||||
|
|
||||||
maxcode = 0x70;
|
maxcode = 0x70;
|
||||||
/*** Justifier ***/
|
/*** Justifier ***/
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 AimOffscreen");
|
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 Trigger");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 Trigger");
|
||||||
|
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 AimOffscreen");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 Start");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 Start");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier2 AimOffscreen");
|
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier2 Trigger");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier2 Trigger");
|
||||||
|
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier2 AimOffscreen");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier2 Start");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier2 Start");
|
||||||
|
|
||||||
maxcode = 0x80;
|
maxcode = 0x80;
|
||||||
@ -708,7 +728,7 @@ void SetDefaultButtonMap ()
|
|||||||
S9xMapPointer( maxcode++, S9xGetCommandT("Pointer Mouse2"), false);
|
S9xMapPointer( maxcode++, S9xGetCommandT("Pointer Mouse2"), false);
|
||||||
S9xMapPointer( maxcode++, S9xGetCommandT("Pointer Justifier1"), false);
|
S9xMapPointer( maxcode++, S9xGetCommandT("Pointer Justifier1"), false);
|
||||||
S9xMapPointer( maxcode++, S9xGetCommandT("Pointer Justifier2"), false);
|
S9xMapPointer( maxcode++, S9xGetCommandT("Pointer Justifier2"), false);
|
||||||
|
|
||||||
maxcode = 0x90;
|
maxcode = 0x90;
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Screenshot");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Screenshot");
|
||||||
|
|
||||||
|
@ -20,19 +20,13 @@
|
|||||||
#define PADCAL 50
|
#define PADCAL 50
|
||||||
#define MAXJP 12 // # of mappable controller buttons
|
#define MAXJP 12 // # of mappable controller buttons
|
||||||
|
|
||||||
extern unsigned int gcpadmap[];
|
extern int rumbleRequest[4];
|
||||||
extern unsigned int wmpadmap[];
|
extern u32 btnmap[4][4][12];
|
||||||
extern unsigned int ccpadmap[];
|
|
||||||
extern unsigned int ncpadmap[];
|
|
||||||
extern unsigned int gcscopemap[];
|
|
||||||
extern unsigned int wmscopemap[];
|
|
||||||
extern unsigned int gcmousemap[];
|
|
||||||
extern unsigned int wmmousemap[];
|
|
||||||
extern unsigned int gcjustmap[];
|
|
||||||
extern unsigned int wmjustmap[];
|
|
||||||
|
|
||||||
void ResetControls();
|
void ResetControls();
|
||||||
s8 WPAD_Stick(u8 chan,u8 right, int axis);
|
void ShutoffRumble();
|
||||||
|
void DoRumble(int i);
|
||||||
|
s8 WPAD_Stick(u8 chan, u8 right, int axis);
|
||||||
void UpdateCursorPosition (int pad, int &pos_x, int &pos_y);
|
void UpdateCursorPosition (int pad, int &pos_x, int &pos_y);
|
||||||
void decodepad (int pad);
|
void decodepad (int pad);
|
||||||
void NGCReportButtons ();
|
void NGCReportButtons ();
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May-June 2007
|
* crunchy2 May-June 2007
|
||||||
* Tantric September 2008
|
* Tantric 2008-2009
|
||||||
*
|
*
|
||||||
* memcardop.cpp
|
* memcardop.cpp
|
||||||
*
|
*
|
||||||
@ -19,100 +19,120 @@
|
|||||||
|
|
||||||
#include "snes9xGX.h"
|
#include "snes9xGX.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "menudraw.h"
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
#include "filebrowser.h"
|
||||||
#include "fileop.h"
|
#include "fileop.h"
|
||||||
|
#include "dvd.h"
|
||||||
|
|
||||||
|
static u8 * SysArea = NULL;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* CardFileExists
|
* MountMC
|
||||||
*
|
|
||||||
* Wrapper to search through the files on the card.
|
|
||||||
* Returns TRUE if found.
|
|
||||||
***************************************************************************/
|
|
||||||
static int
|
|
||||||
CardFileExists (char *filename, int slot)
|
|
||||||
{
|
|
||||||
card_dir CardDir;
|
|
||||||
int CardError;
|
|
||||||
|
|
||||||
CardError = CARD_FindFirst (slot, &CardDir, TRUE);
|
|
||||||
while (CardError != CARD_ERROR_NOFILE)
|
|
||||||
{
|
|
||||||
CardError = CARD_FindNext (&CardDir);
|
|
||||||
|
|
||||||
if (strcmp ((char *) CardDir.filename, filename) == 0)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* MountCard
|
|
||||||
*
|
*
|
||||||
* Mounts the memory card in the given slot.
|
* Mounts the memory card in the given slot.
|
||||||
* Returns the result of the last attempted CARD_Mount command.
|
* Returns the result of the last attempted CARD_Mount command.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static int MountCard(int cslot, bool silent, u8 * SysArea)
|
static int MountMC(int slot, bool silent)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
|
|
||||||
|
// Initialize Card System
|
||||||
|
SysArea = (u8 *)memalign(32, CARD_WORKAREA);
|
||||||
|
memset (SysArea, 0, CARD_WORKAREA);
|
||||||
|
CARD_Init ("SNES", "00");
|
||||||
|
|
||||||
// Mount the card
|
// Mount the card
|
||||||
while ( tries < 10 && ret != 0)
|
while(tries < 10 && ret != 0)
|
||||||
{
|
{
|
||||||
EXI_ProbeReset ();
|
EXI_ProbeReset();
|
||||||
ret = CARD_Mount (cslot, &SysArea, NULL);
|
ret = CARD_Mount (slot, SysArea, NULL);
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync();
|
||||||
tries++;
|
tries++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ret != 0 && !silent)
|
||||||
|
{
|
||||||
|
if (slot == CARD_SLOTA)
|
||||||
|
ErrorPrompt("Unable to mount Slot A Memory Card!");
|
||||||
|
else
|
||||||
|
ErrorPrompt("Unable to mount Slot B Memory Card!");
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* TestCard
|
* TestMC
|
||||||
*
|
*
|
||||||
* Checks to see if a card is in the card slot specified
|
* Checks to see if a card is in the card slot specified
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
bool TestCard(int slot, bool silent)
|
bool TestMC(int slot, bool silent)
|
||||||
{
|
{
|
||||||
// Memory Cards do not work in Wii mode - disable
|
// Memory Cards do not work in Wii mode - disable
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*** Initialize Card System ***/
|
bool ret = false;
|
||||||
u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
|
||||||
memset (SysArea, 0, CARD_WORKAREA);
|
|
||||||
CARD_Init ("SNES", "00");
|
|
||||||
|
|
||||||
/*** Try to mount the card ***/
|
// Try to mount the card
|
||||||
if (MountCard(slot, silent, (u8 *)SysArea) == 0)
|
if (MountMC(slot, silent) == 0)
|
||||||
{
|
{
|
||||||
// Mount successful!
|
// Mount successful!
|
||||||
if(!silent)
|
|
||||||
{
|
|
||||||
if (slot == CARD_SLOTA)
|
|
||||||
WaitPrompt("Mounted Slot A Memory Card!");
|
|
||||||
else
|
|
||||||
WaitPrompt("Mounted Slot B Memory Card!");
|
|
||||||
}
|
|
||||||
CARD_Unmount (slot);
|
CARD_Unmount (slot);
|
||||||
return true;
|
ret = true;
|
||||||
}
|
}
|
||||||
else
|
free(SysArea);
|
||||||
{
|
return ret;
|
||||||
if(!silent)
|
}
|
||||||
{
|
|
||||||
if (slot == CARD_SLOTA)
|
|
||||||
WaitPrompt("Unable to Mount Slot A Memory Card!");
|
|
||||||
else
|
|
||||||
WaitPrompt("Unable to Mount Slot B Memory Card!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
/****************************************************************************
|
||||||
|
* ParseMCDirectory
|
||||||
|
*
|
||||||
|
* Parses a list of all files on the specified memory card
|
||||||
|
***************************************************************************/
|
||||||
|
int
|
||||||
|
ParseMCDirectory (int slot)
|
||||||
|
{
|
||||||
|
card_dir CardDir;
|
||||||
|
int CardError;
|
||||||
|
int entryNum = 0;
|
||||||
|
|
||||||
|
// Try to mount the card
|
||||||
|
CardError = MountMC(slot, NOTSILENT);
|
||||||
|
|
||||||
|
if (CardError == 0)
|
||||||
|
{
|
||||||
|
CardError = CARD_FindFirst (slot, &CardDir, TRUE);
|
||||||
|
while (CardError != CARD_ERROR_NOFILE)
|
||||||
|
{
|
||||||
|
BROWSERENTRY * newBrowserList = (BROWSERENTRY *)realloc(browserList, (entryNum+1) * sizeof(BROWSERENTRY));
|
||||||
|
|
||||||
|
if(!newBrowserList) // failed to allocate required memory
|
||||||
|
{
|
||||||
|
ResetBrowser();
|
||||||
|
ErrorPrompt("Out of memory: too many files!");
|
||||||
|
entryNum = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
browserList = newBrowserList;
|
||||||
|
}
|
||||||
|
memset(&(browserList[entryNum]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
||||||
|
|
||||||
|
strncpy(browserList[entryNum].filename, (char *)CardDir.filename, MAXJOLIET);
|
||||||
|
browserList[entryNum].length = CardDir.filelen;
|
||||||
|
|
||||||
|
entryNum++;
|
||||||
|
|
||||||
|
CardError = CARD_FindNext (&CardDir);
|
||||||
|
}
|
||||||
|
CARD_Unmount(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return entryNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -122,37 +142,28 @@ static int
|
|||||||
VerifyMCFile (char *buf, int slot, char *filename, int datasize)
|
VerifyMCFile (char *buf, int slot, char *filename, int datasize)
|
||||||
{
|
{
|
||||||
card_file CardFile;
|
card_file CardFile;
|
||||||
unsigned char verifbuffer[65536] ATTRIBUTE_ALIGN (32);
|
unsigned char verifybuffer[65536] ATTRIBUTE_ALIGN (32);
|
||||||
int CardError;
|
int CardError;
|
||||||
unsigned int blocks;
|
unsigned int blocks;
|
||||||
unsigned int SectorSize;
|
unsigned int SectorSize;
|
||||||
char msg[80];
|
|
||||||
int bytesleft = 0;
|
int bytesleft = 0;
|
||||||
int bytesread = 0;
|
int bytesread = 0;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
/*** Initialize Card System ***/
|
memset (verifybuffer, 0, 65536);
|
||||||
u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
|
||||||
memset (SysArea, 0, CARD_WORKAREA);
|
|
||||||
CARD_Init ("SNES", "00");
|
|
||||||
|
|
||||||
/*** Try to mount the card ***/
|
// Get Sector Size
|
||||||
CardError = MountCard(slot, NOTSILENT, (u8 *)SysArea);
|
CARD_GetSectorSize (slot, &SectorSize);
|
||||||
|
|
||||||
if (CardError == 0)
|
memset (&CardFile, 0, sizeof (CardFile));
|
||||||
|
CardError = CARD_Open (slot, filename, &CardFile);
|
||||||
|
|
||||||
|
if(CardError)
|
||||||
|
{
|
||||||
|
ErrorPrompt("Unable to open file!");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/*** Get Sector Size ***/
|
|
||||||
CARD_GetSectorSize (slot, &SectorSize);
|
|
||||||
|
|
||||||
if (!CardFileExists (filename, slot))
|
|
||||||
{
|
|
||||||
CARD_Unmount (slot);
|
|
||||||
WaitPrompt("Unable to open file for verify!");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset (&CardFile, 0, sizeof (CardFile));
|
|
||||||
CardError = CARD_Open (slot, filename, &CardFile);
|
|
||||||
|
|
||||||
blocks = CardFile.len;
|
blocks = CardFile.len;
|
||||||
|
|
||||||
if (blocks < SectorSize)
|
if (blocks < SectorSize)
|
||||||
@ -161,41 +172,29 @@ VerifyMCFile (char *buf, int slot, char *filename, int datasize)
|
|||||||
if (blocks % SectorSize)
|
if (blocks % SectorSize)
|
||||||
blocks += SectorSize;
|
blocks += SectorSize;
|
||||||
|
|
||||||
if (blocks > (unsigned int)datasize)
|
if (blocks > (unsigned int)datasize)
|
||||||
blocks = datasize;
|
blocks = datasize;
|
||||||
|
|
||||||
memset (verifbuffer, 0, 65536);
|
|
||||||
bytesleft = blocks;
|
bytesleft = blocks;
|
||||||
bytesread = 0;
|
bytesread = 0;
|
||||||
while (bytesleft > 0)
|
while (bytesleft > 0)
|
||||||
{
|
{
|
||||||
CARD_Read (&CardFile, verifbuffer, SectorSize, bytesread);
|
CARD_Read (&CardFile, verifybuffer, SectorSize, bytesread);
|
||||||
if ( memcmp (buf + bytesread, verifbuffer, (unsigned int)bytesleft < SectorSize ? bytesleft : SectorSize) )
|
if ( memcmp (buf + bytesread, verifybuffer, (unsigned int)bytesleft < SectorSize ? bytesleft : SectorSize) )
|
||||||
{
|
{
|
||||||
CARD_Close (&CardFile);
|
ErrorPrompt("File integrity could not be verified!");
|
||||||
CARD_Unmount (slot);
|
break;
|
||||||
WaitPrompt("File did not verify!");
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bytesleft -= SectorSize;
|
bytesleft -= SectorSize;
|
||||||
bytesread += SectorSize;
|
bytesread += SectorSize;
|
||||||
|
|
||||||
sprintf (msg, "Verified %d of %d bytes", bytesread, blocks);
|
ShowProgress ("Verifying...", bytesread, blocks);
|
||||||
ShowProgress (msg, bytesread, blocks);
|
|
||||||
}
|
}
|
||||||
CARD_Close (&CardFile);
|
CARD_Close (&CardFile);
|
||||||
CARD_Unmount (slot);
|
CancelAction();
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
else
|
return ret;
|
||||||
if (slot == CARD_SLOTA)
|
|
||||||
WaitPrompt("Unable to Mount Slot A Memory Card!");
|
|
||||||
else
|
|
||||||
WaitPrompt("Unable to Mount Slot B Memory Card!");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -212,56 +211,55 @@ LoadMCFile (char *buf, int slot, char *filename, bool silent)
|
|||||||
int bytesleft = 0;
|
int bytesleft = 0;
|
||||||
int bytesread = 0;
|
int bytesread = 0;
|
||||||
|
|
||||||
/*** Initialize Card System ***/
|
// Try to mount the card
|
||||||
u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
CardError = MountMC(slot, NOTSILENT);
|
||||||
memset (SysArea, 0, CARD_WORKAREA);
|
|
||||||
CARD_Init ("SNES", "00");
|
|
||||||
|
|
||||||
/*** Try to mount the card ***/
|
|
||||||
CardError = MountCard(slot, NOTSILENT, (u8 *)SysArea);
|
|
||||||
|
|
||||||
if (CardError == 0)
|
if (CardError == 0)
|
||||||
{
|
{
|
||||||
/*** Get Sector Size ***/
|
// Get Sector Size
|
||||||
CARD_GetSectorSize (slot, &SectorSize);
|
CARD_GetSectorSize (slot, &SectorSize);
|
||||||
|
|
||||||
if (!CardFileExists (filename, slot))
|
|
||||||
{
|
|
||||||
if (!silent)
|
|
||||||
WaitPrompt("Unable to open file");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset (&CardFile, 0, sizeof (CardFile));
|
memset (&CardFile, 0, sizeof (CardFile));
|
||||||
CardError = CARD_Open (slot, filename, &CardFile);
|
CardError = CARD_Open (slot, filename, &CardFile);
|
||||||
|
|
||||||
blocks = CardFile.len;
|
if(CardError)
|
||||||
|
|
||||||
if (blocks < SectorSize)
|
|
||||||
blocks = SectorSize;
|
|
||||||
|
|
||||||
if (blocks % SectorSize)
|
|
||||||
blocks += SectorSize;
|
|
||||||
|
|
||||||
memset (buf, 0, 0x22000);
|
|
||||||
|
|
||||||
bytesleft = blocks;
|
|
||||||
bytesread = 0;
|
|
||||||
while (bytesleft > 0)
|
|
||||||
{
|
{
|
||||||
CARD_Read (&CardFile, buf + bytesread, SectorSize, bytesread);
|
ErrorPrompt("Unable to open file!");
|
||||||
bytesleft -= SectorSize;
|
|
||||||
bytesread += SectorSize;
|
|
||||||
}
|
}
|
||||||
CARD_Close (&CardFile);
|
|
||||||
CARD_Unmount (slot);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (slot == CARD_SLOTA)
|
|
||||||
WaitPrompt("Unable to Mount Slot A Memory Card!");
|
|
||||||
else
|
else
|
||||||
WaitPrompt("Unable to Mount Slot B Memory Card!");
|
{
|
||||||
|
blocks = CardFile.len;
|
||||||
|
|
||||||
|
if (blocks < SectorSize)
|
||||||
|
blocks = SectorSize;
|
||||||
|
|
||||||
|
if (blocks % SectorSize)
|
||||||
|
blocks += SectorSize;
|
||||||
|
|
||||||
|
bytesleft = blocks;
|
||||||
|
bytesread = 0;
|
||||||
|
while (bytesleft > 0)
|
||||||
|
{
|
||||||
|
CardError = CARD_Read (&CardFile, buf + bytesread, SectorSize, bytesread);
|
||||||
|
|
||||||
|
if(CardError)
|
||||||
|
{
|
||||||
|
ErrorPrompt("Error loading file!");
|
||||||
|
bytesread = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bytesleft -= SectorSize;
|
||||||
|
bytesread += SectorSize;
|
||||||
|
ShowProgress ("Loading...", bytesread, blocks);
|
||||||
|
}
|
||||||
|
CARD_Close (&CardFile);
|
||||||
|
CancelAction();
|
||||||
|
}
|
||||||
|
CARD_Unmount(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(SysArea);
|
||||||
return bytesread;
|
return bytesread;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,99 +275,53 @@ SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent)
|
|||||||
int CardError;
|
int CardError;
|
||||||
unsigned int blocks;
|
unsigned int blocks;
|
||||||
unsigned int SectorSize;
|
unsigned int SectorSize;
|
||||||
char msg[80];
|
int byteswritten = 0;
|
||||||
|
int bytesleft = 0;
|
||||||
|
|
||||||
if(datasize <= 0)
|
if(datasize <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*** Initialize Card System ***/
|
// Try to mount the card
|
||||||
u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
CardError = MountMC(slot, NOTSILENT);
|
||||||
memset (SysArea, 0, CARD_WORKAREA);
|
|
||||||
CARD_Init ("SNES", "00");
|
|
||||||
|
|
||||||
/*** Try to mount the card ***/
|
|
||||||
CardError = MountCard(slot, NOTSILENT, (u8 *)SysArea);
|
|
||||||
|
|
||||||
if (CardError == 0)
|
if (CardError == 0)
|
||||||
{
|
{
|
||||||
/*** Get Sector Size ***/
|
// Get Sector Size
|
||||||
CARD_GetSectorSize (slot, &SectorSize);
|
CARD_GetSectorSize (slot, &SectorSize);
|
||||||
|
|
||||||
/*** Calculate number of blocks required ***/
|
// Calculate number of blocks required
|
||||||
blocks = (datasize / SectorSize) * SectorSize;
|
blocks = (datasize / SectorSize) * SectorSize;
|
||||||
if (datasize % SectorSize)
|
if (datasize % SectorSize)
|
||||||
blocks += SectorSize;
|
blocks += SectorSize;
|
||||||
|
|
||||||
/*** Does this file exist ? ***/
|
// Delete existing file (if present)
|
||||||
if (CardFileExists (filename, slot))
|
memset(&CardStatus, 0, sizeof(card_stat));
|
||||||
|
CardError = CARD_Open (slot, filename, &CardFile);
|
||||||
|
|
||||||
|
if(CardError == 0)
|
||||||
{
|
{
|
||||||
/*** Try to open the file ***/
|
CARD_Close (&CardFile);
|
||||||
CardError = CARD_Open (slot, filename, &CardFile);
|
CardError = CARD_Delete(slot, filename);
|
||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
CARD_Unmount (slot);
|
ErrorPrompt("Unable to delete existing file!");
|
||||||
WaitPrompt("Unable to open card file!");
|
goto done;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (s32)blocks > CardFile.len ) /*** new data is longer ***/
|
|
||||||
{
|
|
||||||
CARD_Close (&CardFile);
|
|
||||||
|
|
||||||
/*** Try to create temp file to check available space ***/
|
|
||||||
CardError = CARD_Create (slot, "TEMPFILESNES9XGX201", blocks, &CardFile);
|
|
||||||
if (CardError)
|
|
||||||
{
|
|
||||||
CARD_Unmount (slot);
|
|
||||||
WaitPrompt("Not enough space to update file!");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Delete the temporary file ***/
|
|
||||||
CARD_Close (&CardFile);
|
|
||||||
CardError = CARD_Delete(slot, "TEMPFILESNES9XGX201");
|
|
||||||
if (CardError)
|
|
||||||
{
|
|
||||||
CARD_Unmount (slot);
|
|
||||||
WaitPrompt("Unable to delete temporary file!");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Delete the existing shorter file ***/
|
|
||||||
CardError = CARD_Delete(slot, filename);
|
|
||||||
if (CardError)
|
|
||||||
{
|
|
||||||
CARD_Unmount (slot);
|
|
||||||
WaitPrompt("Unable to delete existing file!");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Create new, longer file ***/
|
|
||||||
CardError = CARD_Create (slot, filename, blocks, &CardFile);
|
|
||||||
if (CardError)
|
|
||||||
{
|
|
||||||
CARD_Unmount (slot);
|
|
||||||
WaitPrompt("Unable to create updated card file!");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else /*** no file existed, create new one ***/
|
|
||||||
{
|
|
||||||
/*** Create new file ***/
|
|
||||||
CardError = CARD_Create (slot, filename, blocks, &CardFile);
|
|
||||||
if (CardError)
|
|
||||||
{
|
|
||||||
CARD_Unmount (slot);
|
|
||||||
if ( CardError == CARD_ERROR_INSSPACE )
|
|
||||||
WaitPrompt("Not enough space to create file!");
|
|
||||||
else
|
|
||||||
WaitPrompt("Unable to create card file!");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Now, have an open file handle, ready to send out the data ***/
|
// Create new file
|
||||||
|
memset(&CardStatus, 0, sizeof(card_stat));
|
||||||
|
CardError = CARD_Create (slot, filename, blocks, &CardFile);
|
||||||
|
if (CardError)
|
||||||
|
{
|
||||||
|
if (CardError == CARD_ERROR_INSSPACE)
|
||||||
|
ErrorPrompt("Insufficient space to create file!");
|
||||||
|
else
|
||||||
|
ErrorPrompt("Unable to create card file!");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now, have an open file handle, ready to send out the data
|
||||||
CARD_GetStatus (slot, CardFile.filenum, &CardStatus);
|
CARD_GetStatus (slot, CardFile.filenum, &CardStatus);
|
||||||
CardStatus.icon_addr = 0x0;
|
CardStatus.icon_addr = 0x0;
|
||||||
CardStatus.icon_fmt = 2;
|
CardStatus.icon_fmt = 2;
|
||||||
@ -377,40 +329,39 @@ SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent)
|
|||||||
CardStatus.comment_addr = 2048;
|
CardStatus.comment_addr = 2048;
|
||||||
CARD_SetStatus (slot, CardFile.filenum, &CardStatus);
|
CARD_SetStatus (slot, CardFile.filenum, &CardStatus);
|
||||||
|
|
||||||
int byteswritten = 0;
|
bytesleft = blocks;
|
||||||
int bytesleft = blocks;
|
|
||||||
while (bytesleft > 0)
|
while (bytesleft > 0)
|
||||||
{
|
{
|
||||||
CardError =
|
CardError =
|
||||||
CARD_Write (&CardFile, buf + byteswritten,
|
CARD_Write (&CardFile, buf + byteswritten,
|
||||||
SectorSize, byteswritten);
|
SectorSize, byteswritten);
|
||||||
|
|
||||||
|
if(CardError)
|
||||||
|
{
|
||||||
|
ErrorPrompt("Error writing file!");
|
||||||
|
byteswritten = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
bytesleft -= SectorSize;
|
bytesleft -= SectorSize;
|
||||||
byteswritten += SectorSize;
|
byteswritten += SectorSize;
|
||||||
|
|
||||||
sprintf (msg, "Wrote %d of %d bytes", byteswritten, blocks);
|
ShowProgress ("Saving...", byteswritten, blocks);
|
||||||
ShowProgress (msg, byteswritten, blocks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CARD_Close (&CardFile);
|
CARD_Close (&CardFile);
|
||||||
CARD_Unmount (slot);
|
CancelAction();
|
||||||
|
|
||||||
if ( GCSettings.VerifySaves )
|
if (byteswritten > 0 && GCSettings.VerifySaves)
|
||||||
{
|
{
|
||||||
/*** Verify the written file, but only up to the length we wrote
|
// Verify the written file
|
||||||
because the file could be longer due to past writes ***/
|
if (!VerifyMCFile (buf, slot, filename, byteswritten) )
|
||||||
if ( VerifyMCFile (buf, slot, filename, byteswritten) )
|
byteswritten = 0;
|
||||||
return byteswritten;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
else
|
done:
|
||||||
return byteswritten;
|
CARD_Unmount (slot);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if (slot == CARD_SLOTA)
|
|
||||||
WaitPrompt("Unable to Mount Slot A Memory Card!");
|
|
||||||
else
|
|
||||||
WaitPrompt("Unable to Mount Slot B Memory Card!");
|
|
||||||
|
|
||||||
return 0;
|
free(SysArea);
|
||||||
|
return byteswritten;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May-June 2007
|
* crunchy2 May-June 2007
|
||||||
* Tantric September 2008
|
* Tantric 2008-2009
|
||||||
*
|
*
|
||||||
* memcardop.cpp
|
* memcardop.cpp
|
||||||
*
|
*
|
||||||
@ -13,8 +13,9 @@
|
|||||||
#ifndef _NGCMCSAVE_
|
#ifndef _NGCMCSAVE_
|
||||||
#define _NGCMCSAVE_
|
#define _NGCMCSAVE_
|
||||||
|
|
||||||
|
int ParseMCDirectory (int slot);
|
||||||
int LoadMCFile (char *buf, int slot, char *filename, bool silent);
|
int LoadMCFile (char *buf, int slot, char *filename, bool silent);
|
||||||
int SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent);
|
int SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent);
|
||||||
bool TestCard(int slot, bool silent);
|
bool TestMC(int slot, bool silent);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|