mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-03 16:44:20 +01:00
* Added Abz's 1076 mod patch with code cleanup by me. His patch includes:
- private server - sicksaxis to be able to a ps3 controller in wiiflow - support for the latest nintendont with argsboot - other minor changes that i may or may not change soon. - credit to Abz, Airline38, and anyone else who helped with coding.
This commit is contained in:
parent
549061586a
commit
7bad8c3fd3
404
Makefile.main
404
Makefile.main
@ -1,202 +1,202 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
include $(DEVKITPPC)/wii_rules
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := boot
|
||||
BUILD := build
|
||||
SOURCES := source \
|
||||
source/booter \
|
||||
source/banner \
|
||||
source/channel \
|
||||
source/cheats \
|
||||
source/config \
|
||||
source/data \
|
||||
source/devicemounter \
|
||||
source/fileOps \
|
||||
source/gc \
|
||||
source/gecko \
|
||||
source/gui \
|
||||
source/hw \
|
||||
source/homebrew \
|
||||
source/libwbfs \
|
||||
source/list \
|
||||
source/loader \
|
||||
source/memory \
|
||||
source/menu \
|
||||
source/music \
|
||||
source/network \
|
||||
source/plugin \
|
||||
source/unzip \
|
||||
source/xml \
|
||||
source/wstringEx
|
||||
|
||||
DATA := data \
|
||||
data/images \
|
||||
data/help \
|
||||
data/sounds
|
||||
INCLUDES := source
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Default build shell script options
|
||||
#---------------------------------------------------------------------------------
|
||||
ios := 249
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
CFLAGS = -g -ggdb -Os -Wall -Wextra $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,wiiuse_register
|
||||
|
||||
ifeq ($(BUILDMODE),channel)
|
||||
CFLAGS += -DFULLCHANNEL
|
||||
CXXFLAGS += -DFULLCHANNEL
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lcustomfat -lcustomntfs -lcustomext2fs -lpng -lturbojpeg -lm -lz -lwiiuse -lwupc -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(CURDIR)/portlibs
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
export PROJECTDIR := $(CURDIR)
|
||||
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
export CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
export CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
ELFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.elf)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin)))
|
||||
TTFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ttf)))
|
||||
PNGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.png)))
|
||||
OGGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ogg)))
|
||||
WAVFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.wav)))
|
||||
DOLFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.dol)))
|
||||
TXTFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.txt)))
|
||||
JPGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.jpg)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o) \
|
||||
$(PNGFILES:.png=.png.o) $(JPGFILES:.jpg=.jpg.o) \
|
||||
$(OGGFILES:.ogg=.ogg.o) $(TXTFILES:.txt=.txt.o) \
|
||||
$(WAVFILES:.wav=.wav.o) $(addsuffix .o,$(BINFILES))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) -I$(LIBOGC_INC) \
|
||||
-I$(PORTLIBS)/include
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) -L$(CURDIR)/source/libs/libfat/ \
|
||||
-L$(CURDIR)/source/libs/libntfs/ -L$(CURDIR)/source/libs/libext2fs/ \
|
||||
-L$(LIBOGC_LIB) -L$(PORTLIBS)/lib
|
||||
|
||||
export OUTPUT := $(CURDIR)/out/$(TARGET)
|
||||
.PHONY: $(BUILD) all clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@bash ./scripts/svnrev.sh
|
||||
@bash ./scripts/buildtype.sh $(ios)
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.main
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all:
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.main
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol $(CURDIR)/source/svnrev.h \
|
||||
$(CURDIR)/source/loader/alt_ios_gen.h $(CURDIR)/out/bins/ext_loader.bin \
|
||||
$(CURDIR)/out/bins/ext_booter.bin $(CURDIR)/out/bins/app_booter.bin
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule links in binary data with .ttf, .png, and .mp3 extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
%.png.o : %.png
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
%.ogg.o : %.ogg
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
%.wav.o : %.wav
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
%.bin.o : %.bin
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
%.txt.o : %.txt
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
%.jpg.o : %.jpg
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
export PATH := $(PROJECTDIR)/gettext-bin:$(PATH)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
include $(DEVKITPPC)/wii_rules
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := boot
|
||||
BUILD := build
|
||||
SOURCES := source \
|
||||
source/booter \
|
||||
source/banner \
|
||||
source/channel \
|
||||
source/cheats \
|
||||
source/config \
|
||||
source/data \
|
||||
source/devicemounter \
|
||||
source/fileOps \
|
||||
source/gc \
|
||||
source/gecko \
|
||||
source/gui \
|
||||
source/hw \
|
||||
source/homebrew \
|
||||
source/libwbfs \
|
||||
source/list \
|
||||
source/loader \
|
||||
source/memory \
|
||||
source/menu \
|
||||
source/music \
|
||||
source/network \
|
||||
source/plugin \
|
||||
source/unzip \
|
||||
source/xml \
|
||||
source/wstringEx
|
||||
SOURCES += source/sicksaxis-wrapper
|
||||
DATA := data \
|
||||
data/images \
|
||||
data/help \
|
||||
data/sounds
|
||||
INCLUDES := source
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Default build shell script options
|
||||
#---------------------------------------------------------------------------------
|
||||
ios := 249
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
CFLAGS = -g -ggdb -Os -Wall -Wextra $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,wiiuse_register
|
||||
|
||||
ifeq ($(BUILDMODE),channel)
|
||||
CFLAGS += -DFULLCHANNEL
|
||||
CXXFLAGS += -DFULLCHANNEL
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lcustomfat -lcustomntfs -lcustomext2fs -lpng -lturbojpeg -lm -lz -lwiiuse -lwupc -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad -lsicksaxis
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(CURDIR)/portlibs
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
export PROJECTDIR := $(CURDIR)
|
||||
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
export CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
export CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
ELFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.elf)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin)))
|
||||
TTFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ttf)))
|
||||
PNGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.png)))
|
||||
OGGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ogg)))
|
||||
WAVFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.wav)))
|
||||
DOLFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.dol)))
|
||||
TXTFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.txt)))
|
||||
JPGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.jpg)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o) \
|
||||
$(PNGFILES:.png=.png.o) $(JPGFILES:.jpg=.jpg.o) \
|
||||
$(OGGFILES:.ogg=.ogg.o) $(TXTFILES:.txt=.txt.o) \
|
||||
$(WAVFILES:.wav=.wav.o) $(addsuffix .o,$(BINFILES))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) -I$(LIBOGC_INC) \
|
||||
-I$(PORTLIBS)/include
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) -L$(CURDIR)/source/libs/libfat/ \
|
||||
-L$(CURDIR)/source/libs/libntfs/ -L$(CURDIR)/source/libs/libext2fs/ \
|
||||
-L$(LIBOGC_LIB) -L$(PORTLIBS)/lib
|
||||
|
||||
export OUTPUT := $(CURDIR)/out/$(TARGET)
|
||||
.PHONY: $(BUILD) all clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@bash ./scripts/svnrev.sh
|
||||
@bash ./scripts/buildtype.sh $(ios)
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.main
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all:
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.main
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol $(CURDIR)/source/svnrev.h \
|
||||
$(CURDIR)/source/loader/alt_ios_gen.h $(CURDIR)/out/bins/ext_loader.bin \
|
||||
$(CURDIR)/out/bins/ext_booter.bin $(CURDIR)/out/bins/app_booter.bin
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule links in binary data with .ttf, .png, and .mp3 extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
%.png.o : %.png
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
%.ogg.o : %.ogg
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
%.wav.o : %.wav
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
%.bin.o : %.bin
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
%.txt.o : %.txt
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
%.jpg.o : %.jpg
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
export PATH := $(PROJECTDIR)/gettext-bin:$(PATH)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
1
out/bins/ReadMe.txt
Normal file
1
out/bins/ReadMe.txt
Normal file
@ -0,0 +1 @@
|
||||
Folder needed for app_booter.bin, ext_booter.bin, and ext_loader.bin
|
@ -1,58 +1,59 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#ifndef _CFG_HPP_
|
||||
#define _CFG_HPP_
|
||||
|
||||
#include "cios.h"
|
||||
#include "frag.h"
|
||||
#include "wip.h"
|
||||
|
||||
struct the_CFG {
|
||||
/* needed for wii games */
|
||||
char gameID[7];
|
||||
FragList *fragments;
|
||||
s32 wbfsDevice;
|
||||
u32 wbfsPart;
|
||||
u8 GameBootType;
|
||||
WIP_Code *wip_list;
|
||||
u32 wip_count;
|
||||
bool use_led;
|
||||
bool patchregion;
|
||||
/* needed for channels */
|
||||
u64 title;
|
||||
bool use_dol;
|
||||
/* General Stuff */
|
||||
IOS_Info IOS;
|
||||
u8 BootType;
|
||||
u8 vidMode;
|
||||
u8 patchVidMode;
|
||||
u8 configbytes[2];
|
||||
u8 debugger;
|
||||
u8 vipatch;
|
||||
u8 countryString;
|
||||
int aspectRatio;
|
||||
void *codelist;
|
||||
u8 *codelistend;
|
||||
u8 *cheats;
|
||||
u32 cheatSize;
|
||||
u32 hooktype;
|
||||
u32 *gameconf;
|
||||
u32 gameconfsize;
|
||||
u32 returnTo;
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
#endif /* _CFG_HPP_ */
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#ifndef _CFG_HPP_
|
||||
#define _CFG_HPP_
|
||||
|
||||
#include "cios.h"
|
||||
#include "frag.h"
|
||||
#include "wip.h"
|
||||
|
||||
struct the_CFG {
|
||||
/* needed for wii games */
|
||||
char gameID[7];
|
||||
FragList *fragments;
|
||||
s32 wbfsDevice;
|
||||
u32 wbfsPart;
|
||||
u8 GameBootType;
|
||||
WIP_Code *wip_list;
|
||||
u32 wip_count;
|
||||
bool use_led;
|
||||
bool patchregion;
|
||||
bool private_server;
|
||||
/* needed for channels */
|
||||
u64 title;
|
||||
bool use_dol;
|
||||
/* General Stuff */
|
||||
IOS_Info IOS;
|
||||
u8 BootType;
|
||||
u8 vidMode;
|
||||
u8 patchVidMode;
|
||||
u8 configbytes[2];
|
||||
u8 debugger;
|
||||
u8 vipatch;
|
||||
u8 countryString;
|
||||
int aspectRatio;
|
||||
void *codelist;
|
||||
u8 *codelistend;
|
||||
u8 *cheats;
|
||||
u32 cheatSize;
|
||||
u32 hooktype;
|
||||
u32 *gameconf;
|
||||
u32 gameconfsize;
|
||||
u32 returnTo;
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
#endif /* _CFG_HPP_ */
|
||||
|
@ -29,7 +29,7 @@ static const char *GameID = (const char*)0x80000000;
|
||||
#define APPLDR_CODE 0x918
|
||||
|
||||
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch,
|
||||
bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion);
|
||||
bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion, bool private_server);
|
||||
static void patch_NoDiscinDrive(void *buffer, u32 len);
|
||||
static void Anti_002_fix(void *Address, int Size);
|
||||
static bool Remove_001_Protection(void *Address, int Size);
|
||||
@ -47,7 +47,7 @@ static struct
|
||||
s32 padding;
|
||||
} apploader_hdr ATTRIBUTE_ALIGN(32);
|
||||
|
||||
u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion)
|
||||
u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion , bool private_server)
|
||||
{
|
||||
PrinceOfPersiaPatch();
|
||||
NewSuperMarioBrosPatch();
|
||||
@ -94,7 +94,7 @@ u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryStrin
|
||||
/* Read data from DVD */
|
||||
WDVD_Read(dst, len, offset);
|
||||
maindolpatches(dst, len, vidMode, vmode, vipatch, countryString,
|
||||
patchVidModes, aspectRatio, returnTo, patchregion);
|
||||
patchVidModes, aspectRatio, returnTo, patchregion, private_server);
|
||||
DCFlushRange(dst, len);
|
||||
ICInvalidateRange(dst, len);
|
||||
prog(20);
|
||||
@ -107,7 +107,7 @@ u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryStrin
|
||||
return (u32)appldr_final();
|
||||
}
|
||||
|
||||
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion)
|
||||
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion , bool private_server)
|
||||
{
|
||||
do_wip_code((u8 *)dst, len);
|
||||
Remove_001_Protection(dst, len);
|
||||
@ -135,6 +135,8 @@ void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipa
|
||||
PatchReturnTo(dst, len, returnTo);
|
||||
if(patchregion)
|
||||
PatchRegion(dst, len);
|
||||
if(private_server)
|
||||
PrivateServerPatcher(dst,len);
|
||||
}
|
||||
|
||||
static void patch_NoDiscinDrive(void *buffer, u32 len)
|
||||
|
@ -1,16 +1,16 @@
|
||||
#ifndef _APPLOADER_H_
|
||||
#define _APPLOADER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Prototypes */
|
||||
u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString,
|
||||
u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
#ifndef _APPLOADER_H_
|
||||
#define _APPLOADER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Prototypes */
|
||||
u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString,
|
||||
u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion, bool private_server);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
@ -1,213 +1,213 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ogcsys.h>
|
||||
#include <unistd.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "Config.hpp"
|
||||
#include "ChannelHandler.hpp"
|
||||
#include "video_tinyload.h"
|
||||
#include "apploader.h"
|
||||
#include "patchcode.h"
|
||||
#include "memory.h"
|
||||
#include "utils.h"
|
||||
#include "disc.h"
|
||||
#include "fst.h"
|
||||
#include "wdvd.h"
|
||||
#include "gecko.h"
|
||||
|
||||
#define EXT_ADDR_CFG ((vu32*)0x90100000)
|
||||
using namespace std;
|
||||
IOS_Info CurrentIOS;
|
||||
|
||||
/* Boot Variables */
|
||||
u32 GameIOS = 0;
|
||||
u32 vmode_reg = 0;
|
||||
GXRModeObj *vmode = NULL;
|
||||
|
||||
u32 AppEntrypoint = 0;
|
||||
|
||||
extern "C" {
|
||||
extern void __exception_closeall();
|
||||
extern s32 wbfsDev;
|
||||
extern u32 wbfs_part_idx;
|
||||
extern FragList *frag_list;
|
||||
}
|
||||
|
||||
the_CFG normalCFG;
|
||||
int main()
|
||||
{
|
||||
InitGecko();
|
||||
gprintf("WiiFlow External Booter by FIX94\n");
|
||||
memcpy(&normalCFG, ((void*)*EXT_ADDR_CFG), sizeof(the_CFG));
|
||||
VIDEO_Init();
|
||||
video_init();
|
||||
prog10();
|
||||
|
||||
configbytes[0] = normalCFG.configbytes[0];
|
||||
configbytes[1] = normalCFG.configbytes[1];
|
||||
hooktype = normalCFG.hooktype;
|
||||
debuggerselect = normalCFG.debugger;
|
||||
CurrentIOS = normalCFG.IOS;
|
||||
set_wip_list(normalCFG.wip_list, normalCFG.wip_count);
|
||||
app_gameconfig_set(normalCFG.gameconf, normalCFG.gameconfsize);
|
||||
ocarina_set_codes(normalCFG.codelist, normalCFG.codelistend, normalCFG.cheats, normalCFG.cheatSize);
|
||||
copy_frag_list(normalCFG.fragments);
|
||||
wbfsDev = normalCFG.wbfsDevice;
|
||||
wbfs_part_idx = normalCFG.wbfsPart;
|
||||
prog10();
|
||||
|
||||
/* Setup Low Memory */
|
||||
Disc_SetLowMemPre();
|
||||
|
||||
if(normalCFG.BootType == TYPE_WII_GAME)
|
||||
{
|
||||
WDVD_Init();
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
{
|
||||
s32 ret = BlockIOSReload();
|
||||
gprintf("Block IOS Reload using d2x %s.\n", ret < 0 ? "failed" : "succeeded");
|
||||
}
|
||||
if(normalCFG.GameBootType == TYPE_WII_DISC)
|
||||
{
|
||||
if(CurrentIOS.Type != IOS_TYPE_NEEK2O)
|
||||
Disc_SetUSB(NULL, false);
|
||||
if(CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
Hermes_Disable_EHC();
|
||||
if(normalCFG.vidMode > 1) //forcing a video mode
|
||||
normalCFG.patchVidMode = 1; //always normal patching
|
||||
}
|
||||
else
|
||||
{
|
||||
Disc_SetUSB((u8*)normalCFG.gameID, normalCFG.GameBootType == TYPE_WII_WBFS_EXT);
|
||||
if(CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
Hermes_shadow_mload();
|
||||
}
|
||||
prog(20);
|
||||
Disc_Open(normalCFG.GameBootType);
|
||||
u32 offset = 0;
|
||||
Disc_FindPartition(&offset);
|
||||
WDVD_OpenPartition(offset, &GameIOS);
|
||||
vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg);
|
||||
AppEntrypoint = Apploader_Run(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString,
|
||||
normalCFG.patchVidMode, normalCFG.aspectRatio, normalCFG.returnTo, normalCFG.patchregion);
|
||||
WDVD_Close();
|
||||
}
|
||||
else if(normalCFG.BootType == TYPE_CHANNEL)
|
||||
{
|
||||
ISFS_Initialize();
|
||||
*Disc_ID = TITLE_LOWER(normalCFG.title);
|
||||
vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg);
|
||||
AppEntrypoint = LoadChannel(normalCFG.title, normalCFG.use_dol, &GameIOS);
|
||||
PatchChannel(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString,
|
||||
normalCFG.patchVidMode, normalCFG.aspectRatio);
|
||||
ISFS_Deinitialize();
|
||||
}
|
||||
gprintf("Entrypoint: %08x, Requested Game IOS: %i\n", AppEntrypoint, GameIOS);
|
||||
setprog(320);
|
||||
|
||||
/* Setup Low Memory */
|
||||
Disc_SetLowMem(GameIOS);
|
||||
if(normalCFG.BootType == TYPE_CHANNEL && AppEntrypoint != 0x3400)
|
||||
Disc_SetLowMemChan(); /* Real DOL without appldr */
|
||||
|
||||
/* Set an appropriate video mode */
|
||||
Disc_SetVMode(vmode, vmode_reg);
|
||||
|
||||
/* Shutdown IOS subsystems */
|
||||
u32 level = IRQ_Disable();
|
||||
__IOS_ShutdownSubsystems();
|
||||
__exception_closeall();
|
||||
|
||||
/* Enable front LED if requested */
|
||||
if(normalCFG.use_led) *HW_GPIOB_OUT |= 0x20;
|
||||
|
||||
/* Originally from tueidj - taken from NeoGamma (thx) */
|
||||
*(vu32*)0xCC003024 = 1;
|
||||
|
||||
if(AppEntrypoint == 0x3400)
|
||||
{
|
||||
if(hooktype)
|
||||
{
|
||||
asm volatile (
|
||||
"lis %r3, returnpoint@h\n"
|
||||
"ori %r3, %r3, returnpoint@l\n"
|
||||
"mtlr %r3\n"
|
||||
"lis %r3, 0x8000\n"
|
||||
"ori %r3, %r3, 0x18A8\n"
|
||||
"nop\n"
|
||||
"mtctr %r3\n"
|
||||
"bctr\n"
|
||||
"returnpoint:\n"
|
||||
"bl DCDisable\n"
|
||||
"bl ICDisable\n"
|
||||
"li %r3, 0\n"
|
||||
"mtsrr1 %r3\n"
|
||||
"lis %r4, AppEntrypoint@h\n"
|
||||
"ori %r4,%r4,AppEntrypoint@l\n"
|
||||
"lwz %r4, 0(%r4)\n"
|
||||
"mtsrr0 %r4\n"
|
||||
"rfi\n"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
asm volatile (
|
||||
"isync\n"
|
||||
"lis %r3, AppEntrypoint@h\n"
|
||||
"ori %r3, %r3, AppEntrypoint@l\n"
|
||||
"lwz %r3, 0(%r3)\n"
|
||||
"mtsrr0 %r3\n"
|
||||
"mfmsr %r3\n"
|
||||
"li %r4, 0x30\n"
|
||||
"andc %r3, %r3, %r4\n"
|
||||
"mtsrr1 %r3\n"
|
||||
"rfi\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
else if(hooktype)
|
||||
{
|
||||
asm volatile (
|
||||
"lis %r3, AppEntrypoint@h\n"
|
||||
"ori %r3, %r3, AppEntrypoint@l\n"
|
||||
"lwz %r3, 0(%r3)\n"
|
||||
"mtlr %r3\n"
|
||||
"lis %r3, 0x8000\n"
|
||||
"ori %r3, %r3, 0x18A8\n"
|
||||
"nop\n"
|
||||
"mtctr %r3\n"
|
||||
"bctr\n"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
asm volatile (
|
||||
"lis %r3, AppEntrypoint@h\n"
|
||||
"ori %r3, %r3, AppEntrypoint@l\n"
|
||||
"lwz %r3, 0(%r3)\n"
|
||||
"mtlr %r3\n"
|
||||
"blr\n"
|
||||
);
|
||||
}
|
||||
IRQ_Restore(level);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ogcsys.h>
|
||||
#include <unistd.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "Config.hpp"
|
||||
#include "ChannelHandler.hpp"
|
||||
#include "video_tinyload.h"
|
||||
#include "apploader.h"
|
||||
#include "patchcode.h"
|
||||
#include "memory.h"
|
||||
#include "utils.h"
|
||||
#include "disc.h"
|
||||
#include "fst.h"
|
||||
#include "wdvd.h"
|
||||
#include "gecko.h"
|
||||
|
||||
#define EXT_ADDR_CFG ((vu32*)0x90100000)
|
||||
using namespace std;
|
||||
IOS_Info CurrentIOS;
|
||||
|
||||
/* Boot Variables */
|
||||
u32 GameIOS = 0;
|
||||
u32 vmode_reg = 0;
|
||||
GXRModeObj *vmode = NULL;
|
||||
|
||||
u32 AppEntrypoint = 0;
|
||||
|
||||
extern "C" {
|
||||
extern void __exception_closeall();
|
||||
extern s32 wbfsDev;
|
||||
extern u32 wbfs_part_idx;
|
||||
extern FragList *frag_list;
|
||||
}
|
||||
|
||||
the_CFG normalCFG;
|
||||
int main()
|
||||
{
|
||||
InitGecko();
|
||||
gprintf("WiiFlow External Booter by FIX94\n");
|
||||
memcpy(&normalCFG, ((void*)*EXT_ADDR_CFG), sizeof(the_CFG));
|
||||
VIDEO_Init();
|
||||
video_init();
|
||||
prog10();
|
||||
|
||||
configbytes[0] = normalCFG.configbytes[0];
|
||||
configbytes[1] = normalCFG.configbytes[1];
|
||||
hooktype = normalCFG.hooktype;
|
||||
debuggerselect = normalCFG.debugger;
|
||||
CurrentIOS = normalCFG.IOS;
|
||||
set_wip_list(normalCFG.wip_list, normalCFG.wip_count);
|
||||
app_gameconfig_set(normalCFG.gameconf, normalCFG.gameconfsize);
|
||||
ocarina_set_codes(normalCFG.codelist, normalCFG.codelistend, normalCFG.cheats, normalCFG.cheatSize);
|
||||
copy_frag_list(normalCFG.fragments);
|
||||
wbfsDev = normalCFG.wbfsDevice;
|
||||
wbfs_part_idx = normalCFG.wbfsPart;
|
||||
prog10();
|
||||
|
||||
/* Setup Low Memory */
|
||||
Disc_SetLowMemPre();
|
||||
|
||||
if(normalCFG.BootType == TYPE_WII_GAME)
|
||||
{
|
||||
WDVD_Init();
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
{
|
||||
s32 ret = BlockIOSReload();
|
||||
gprintf("Block IOS Reload using d2x %s.\n", ret < 0 ? "failed" : "succeeded");
|
||||
}
|
||||
if(normalCFG.GameBootType == TYPE_WII_DISC)
|
||||
{
|
||||
if(CurrentIOS.Type != IOS_TYPE_NEEK2O)
|
||||
Disc_SetUSB(NULL, false);
|
||||
if(CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
Hermes_Disable_EHC();
|
||||
if(normalCFG.vidMode > 1) //forcing a video mode
|
||||
normalCFG.patchVidMode = 1; //always normal patching
|
||||
}
|
||||
else
|
||||
{
|
||||
Disc_SetUSB((u8*)normalCFG.gameID, normalCFG.GameBootType == TYPE_WII_WBFS_EXT);
|
||||
if(CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
Hermes_shadow_mload();
|
||||
}
|
||||
prog(20);
|
||||
Disc_Open(normalCFG.GameBootType);
|
||||
u32 offset = 0;
|
||||
Disc_FindPartition(&offset);
|
||||
WDVD_OpenPartition(offset, &GameIOS);
|
||||
vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg);
|
||||
AppEntrypoint = Apploader_Run(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString,
|
||||
normalCFG.patchVidMode, normalCFG.aspectRatio, normalCFG.returnTo, normalCFG.patchregion, normalCFG.private_server);
|
||||
WDVD_Close();
|
||||
}
|
||||
else if(normalCFG.BootType == TYPE_CHANNEL)
|
||||
{
|
||||
ISFS_Initialize();
|
||||
*Disc_ID = TITLE_LOWER(normalCFG.title);
|
||||
vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg);
|
||||
AppEntrypoint = LoadChannel(normalCFG.title, normalCFG.use_dol, &GameIOS);
|
||||
PatchChannel(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString,
|
||||
normalCFG.patchVidMode, normalCFG.aspectRatio);
|
||||
ISFS_Deinitialize();
|
||||
}
|
||||
gprintf("Entrypoint: %08x, Requested Game IOS: %i\n", AppEntrypoint, GameIOS);
|
||||
setprog(320);
|
||||
|
||||
/* Setup Low Memory */
|
||||
Disc_SetLowMem(GameIOS);
|
||||
if(normalCFG.BootType == TYPE_CHANNEL && AppEntrypoint != 0x3400)
|
||||
Disc_SetLowMemChan(); /* Real DOL without appldr */
|
||||
|
||||
/* Set an appropriate video mode */
|
||||
Disc_SetVMode(vmode, vmode_reg);
|
||||
|
||||
/* Shutdown IOS subsystems */
|
||||
u32 level = IRQ_Disable();
|
||||
__IOS_ShutdownSubsystems();
|
||||
__exception_closeall();
|
||||
|
||||
/* Enable front LED if requested */
|
||||
if(normalCFG.use_led) *HW_GPIOB_OUT |= 0x20;
|
||||
|
||||
/* Originally from tueidj - taken from NeoGamma (thx) */
|
||||
*(vu32*)0xCC003024 = 1;
|
||||
|
||||
if(AppEntrypoint == 0x3400)
|
||||
{
|
||||
if(hooktype)
|
||||
{
|
||||
asm volatile (
|
||||
"lis %r3, returnpoint@h\n"
|
||||
"ori %r3, %r3, returnpoint@l\n"
|
||||
"mtlr %r3\n"
|
||||
"lis %r3, 0x8000\n"
|
||||
"ori %r3, %r3, 0x18A8\n"
|
||||
"nop\n"
|
||||
"mtctr %r3\n"
|
||||
"bctr\n"
|
||||
"returnpoint:\n"
|
||||
"bl DCDisable\n"
|
||||
"bl ICDisable\n"
|
||||
"li %r3, 0\n"
|
||||
"mtsrr1 %r3\n"
|
||||
"lis %r4, AppEntrypoint@h\n"
|
||||
"ori %r4,%r4,AppEntrypoint@l\n"
|
||||
"lwz %r4, 0(%r4)\n"
|
||||
"mtsrr0 %r4\n"
|
||||
"rfi\n"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
asm volatile (
|
||||
"isync\n"
|
||||
"lis %r3, AppEntrypoint@h\n"
|
||||
"ori %r3, %r3, AppEntrypoint@l\n"
|
||||
"lwz %r3, 0(%r3)\n"
|
||||
"mtsrr0 %r3\n"
|
||||
"mfmsr %r3\n"
|
||||
"li %r4, 0x30\n"
|
||||
"andc %r3, %r3, %r4\n"
|
||||
"mtsrr1 %r3\n"
|
||||
"rfi\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
else if(hooktype)
|
||||
{
|
||||
asm volatile (
|
||||
"lis %r3, AppEntrypoint@h\n"
|
||||
"ori %r3, %r3, AppEntrypoint@l\n"
|
||||
"lwz %r3, 0(%r3)\n"
|
||||
"mtlr %r3\n"
|
||||
"lis %r3, 0x8000\n"
|
||||
"ori %r3, %r3, 0x18A8\n"
|
||||
"nop\n"
|
||||
"mtctr %r3\n"
|
||||
"bctr\n"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
asm volatile (
|
||||
"lis %r3, AppEntrypoint@h\n"
|
||||
"ori %r3, %r3, AppEntrypoint@l\n"
|
||||
"lwz %r3, 0(%r3)\n"
|
||||
"mtlr %r3\n"
|
||||
"blr\n"
|
||||
);
|
||||
}
|
||||
IRQ_Restore(level);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -640,3 +640,47 @@ void PatchRegion(void *Address, int Size)
|
||||
addr_start += 4;
|
||||
}
|
||||
}
|
||||
|
||||
/** Patch URLs for private Servers - Thanks to ULGX **/
|
||||
void PrivateServerPatcher(void *addr, u32 len)
|
||||
{
|
||||
// Patch protocol https -> http
|
||||
char *cur = (char *)addr;
|
||||
const char *end = cur + len - 8;
|
||||
do
|
||||
{
|
||||
if (memcmp(cur, "https://", 8) == 0 && cur[8] != 0)
|
||||
{
|
||||
int len = strlen(cur);
|
||||
memmove(cur + 4, cur + 5, len - 5);
|
||||
cur[len - 1] = 0;
|
||||
cur += len;
|
||||
}
|
||||
}
|
||||
while (++cur < end);
|
||||
domainpatcher(addr, len, "wiimmfi.de");
|
||||
}
|
||||
|
||||
void domainpatcher(void *addr, u32 len, const char* domain)
|
||||
{
|
||||
if(strlen("nintendowifi.net") < strlen(domain))
|
||||
return;
|
||||
|
||||
char *cur = (char *)addr;
|
||||
const char *end = cur + len - 16;
|
||||
|
||||
do
|
||||
{
|
||||
if (memcmp(cur, "nintendowifi.net", 16) == 0)
|
||||
{
|
||||
int len = strlen(cur);
|
||||
u8 i;
|
||||
memcpy(cur, domain, strlen(domain));
|
||||
memmove(cur + strlen(domain), cur + 16, len - 16);
|
||||
for(i = 16 - strlen(domain); i > 0 ; i--)
|
||||
cur[len - i ] = 0;
|
||||
cur += len;
|
||||
}
|
||||
}
|
||||
while (++cur < end);
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ bool PatchReturnTo(void *Address, int Size, u32 id);
|
||||
void Patch_fwrite(void *Address, int Size);
|
||||
s32 BlockIOSReload(void);
|
||||
void PatchRegion(void *Address, int Size);
|
||||
void PrivateServerPatcher(void *addr, u32 len);
|
||||
void domainpatcher(void *addr, u32 len, const char* domain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,58 +1,59 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#ifndef _CFG_H_
|
||||
#define _CFG_H_
|
||||
|
||||
#include "loader/cios.h"
|
||||
#include "loader/frag.h"
|
||||
#include "loader/wip.h"
|
||||
|
||||
struct the_CFG {
|
||||
/* needed for wii games */
|
||||
char gameID[7];
|
||||
FragList *fragments;
|
||||
s32 wbfsDevice;
|
||||
u32 wbfsPart;
|
||||
u8 GameBootType;
|
||||
WIP_Code *wip_list;
|
||||
u32 wip_count;
|
||||
bool use_led;
|
||||
bool patchregion;
|
||||
/* needed for channels */
|
||||
u64 title;
|
||||
bool use_dol;
|
||||
/* General Stuff */
|
||||
IOS_Info IOS;
|
||||
u8 BootType;
|
||||
u8 vidMode;
|
||||
u8 patchVidMode;
|
||||
u8 configbytes[2];
|
||||
u8 debugger;
|
||||
u8 vipatch;
|
||||
u8 countryString;
|
||||
int aspectRatio;
|
||||
void *codelist;
|
||||
u8 *codelistend;
|
||||
u8 *cheats;
|
||||
u32 cheatSize;
|
||||
u32 hooktype;
|
||||
u32 *gameconf;
|
||||
u32 gameconfsize;
|
||||
u32 returnTo;
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
#endif /* _CFG_HPP_ */
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#ifndef _CFG_H_
|
||||
#define _CFG_H_
|
||||
|
||||
#include "loader/cios.h"
|
||||
#include "loader/frag.h"
|
||||
#include "loader/wip.h"
|
||||
|
||||
struct the_CFG {
|
||||
/* needed for wii games */
|
||||
char gameID[7];
|
||||
FragList *fragments;
|
||||
s32 wbfsDevice;
|
||||
u32 wbfsPart;
|
||||
u8 GameBootType;
|
||||
WIP_Code *wip_list;
|
||||
u32 wip_count;
|
||||
bool use_led;
|
||||
bool patchregion;
|
||||
bool private_server;
|
||||
/* needed for channels */
|
||||
u64 title;
|
||||
bool use_dol;
|
||||
/* General Stuff */
|
||||
IOS_Info IOS;
|
||||
u8 BootType;
|
||||
u8 vidMode;
|
||||
u8 patchVidMode;
|
||||
u8 configbytes[2];
|
||||
u8 debugger;
|
||||
u8 vipatch;
|
||||
u8 countryString;
|
||||
int aspectRatio;
|
||||
void *codelist;
|
||||
u8 *codelistend;
|
||||
u8 *cheats;
|
||||
u32 cheatSize;
|
||||
u32 hooktype;
|
||||
u32 *gameconf;
|
||||
u32 gameconfsize;
|
||||
u32 returnTo;
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
#endif /* _CFG_HPP_ */
|
||||
|
@ -1,163 +1,164 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <string.h>
|
||||
#include <ogc/machine/processor.h>
|
||||
#include <ogc/lwp_threads.h>
|
||||
#include <ogc/cache.h>
|
||||
#include "external_booter.hpp"
|
||||
#include "Config.h"
|
||||
#include "channel/nand.hpp"
|
||||
#include "devicemounter/DeviceHandler.hpp"
|
||||
#include "fileOps/fileOps.h"
|
||||
#include "gecko/wifi_gecko.hpp"
|
||||
#include "gui/text.hpp"
|
||||
#include "loader/fst.h"
|
||||
#include "loader/mload.h"
|
||||
#include "loader/wdvd.h"
|
||||
#include "loader/sys.h"
|
||||
#include "homebrew/homebrew.h"
|
||||
#include "memory/mem2.hpp"
|
||||
#include "network/FTP_Dir.hpp"
|
||||
#include "network/http.h"
|
||||
#include "plugin/crc32.h"
|
||||
|
||||
/* External WiiFlow Game Booter */
|
||||
the_CFG normalCFG;
|
||||
#define EXT_ADDR_CFG ((vu32*)0x90100000)
|
||||
#define EXT_ADDR ((u8*)0x90110000) //later for 0x80A80000
|
||||
#define LDR_ADDR ((u8*)0x93300000)
|
||||
#define LDR_ENTRY ((entry)LDR_ADDR)
|
||||
|
||||
u8 *extldr_ptr = NULL;
|
||||
size_t extldr_size = 0;
|
||||
|
||||
extern "C" {
|
||||
u8 configbytes[2];
|
||||
u32 hooktype;
|
||||
};
|
||||
|
||||
extern u8 *code_buf;
|
||||
extern u32 code_size;
|
||||
extern void *codelist;
|
||||
extern u8 *codelistend;
|
||||
extern u32 gameconfsize;
|
||||
extern u32 *gameconf;
|
||||
|
||||
u8 *booter_ptr = NULL;
|
||||
size_t booter_size = 0;
|
||||
|
||||
void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode,
|
||||
int aspectRatio, u32 returnTo, u8 BootType, bool use_led)
|
||||
{
|
||||
normalCFG.vidMode = vidMode;
|
||||
normalCFG.vipatch = vipatch;
|
||||
normalCFG.countryString = countryString;
|
||||
normalCFG.patchVidMode = patchVidMode;
|
||||
normalCFG.aspectRatio = aspectRatio;
|
||||
normalCFG.returnTo = returnTo;
|
||||
normalCFG.configbytes[0] = configbytes[0];
|
||||
normalCFG.configbytes[1] = configbytes[1];
|
||||
normalCFG.IOS = CurrentIOS;
|
||||
normalCFG.codelist = codelist;
|
||||
normalCFG.codelistend = codelistend;
|
||||
normalCFG.cheats = code_buf;
|
||||
normalCFG.cheatSize = code_size;
|
||||
normalCFG.hooktype = hooktype;
|
||||
normalCFG.debugger = debuggerselect;
|
||||
normalCFG.gameconf = gameconf;
|
||||
normalCFG.gameconfsize = gameconfsize;
|
||||
normalCFG.BootType = BootType;
|
||||
normalCFG.use_led = use_led;
|
||||
normalCFG.wip_list = get_wip_list();
|
||||
normalCFG.wip_count = get_wip_count();
|
||||
/* Copy CFG Into lower MEM1 so it doesnt get destroyed */
|
||||
DCFlushRange(&normalCFG, sizeof(the_CFG));
|
||||
the_CFG *lowCFG = (the_CFG*)MEM1_lo_alloc(sizeof(the_CFG));
|
||||
memcpy(lowCFG, &normalCFG, sizeof(the_CFG));
|
||||
DCFlushRange(&lowCFG, sizeof(the_CFG));
|
||||
*EXT_ADDR_CFG = ((u32)lowCFG);
|
||||
/* Unmount devices etc */
|
||||
ShutdownBeforeExit();
|
||||
/* Wii Games will need it */
|
||||
net_wc24cleanup();
|
||||
/* Set proper time */
|
||||
settime(secs_to_ticks(time(NULL) - 946684800));
|
||||
/* Copy in booter */
|
||||
memcpy(EXT_ADDR, booter_ptr, booter_size);
|
||||
DCFlushRange(EXT_ADDR, booter_size);
|
||||
/* Loader just for the booter */
|
||||
memcpy(LDR_ADDR, extldr_ptr, extldr_size);
|
||||
DCFlushRange(LDR_ADDR, extldr_size);
|
||||
/* Boot it */
|
||||
JumpToEntry(LDR_ENTRY);
|
||||
}
|
||||
|
||||
bool ExternalBooter_LoadBins(const char *binDir)
|
||||
{
|
||||
extldr_ptr = fsop_ReadFile(fmt("%s/ext_loader.bin", binDir), &extldr_size);
|
||||
if(extldr_size == 0 || extldr_ptr == NULL)
|
||||
return false;
|
||||
|
||||
booter_ptr = fsop_ReadFile(fmt("%s/ext_booter.bin", binDir), &booter_size);
|
||||
if(booter_size > 0 && booter_ptr != NULL)
|
||||
return true;
|
||||
|
||||
free(extldr_ptr);
|
||||
extldr_ptr = NULL;
|
||||
extldr_size = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
extern FragList *frag_list;
|
||||
extern s32 wbfsDev;
|
||||
extern u32 wbfs_part_idx;
|
||||
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, bool patchregion, const char *ID)
|
||||
{
|
||||
memset(&normalCFG, 0, sizeof(the_CFG));
|
||||
normalCFG.GameBootType = dvd ? TYPE_WII_DISC : (wbfs ? TYPE_WII_WBFS : TYPE_WII_WBFS_EXT);
|
||||
strncpy(normalCFG.gameID, ID, 6);
|
||||
normalCFG.fragments = frag_list;
|
||||
normalCFG.wbfsDevice = wbfsDev;
|
||||
normalCFG.wbfsPart = wbfs_part_idx;
|
||||
normalCFG.patchregion = patchregion;
|
||||
}
|
||||
|
||||
void ExternalBooter_ChannelSetup(u64 title, bool dol)
|
||||
{
|
||||
memset(&normalCFG, 0, sizeof(the_CFG));
|
||||
memcpy(&normalCFG.title, &title, sizeof(u64));
|
||||
normalCFG.use_dol = dol;
|
||||
}
|
||||
|
||||
void ShutdownBeforeExit(void)
|
||||
{
|
||||
DeviceHandle.UnMountAll();
|
||||
NandHandle.DeInit_ISFS();
|
||||
WDVD_Close();
|
||||
Close_Inputs();
|
||||
/* Deinit network */
|
||||
if(networkInit == true)
|
||||
{
|
||||
while(net_get_status() == -EBUSY)
|
||||
usleep(50);
|
||||
WiFiDebugger.Close();
|
||||
ftp_endTread();
|
||||
net_deinit();
|
||||
networkInit = false;
|
||||
}
|
||||
}
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#include <gccore.h>
|
||||
#include <string.h>
|
||||
#include <ogc/machine/processor.h>
|
||||
#include <ogc/lwp_threads.h>
|
||||
#include <ogc/cache.h>
|
||||
#include "external_booter.hpp"
|
||||
#include "Config.h"
|
||||
#include "channel/nand.hpp"
|
||||
#include "devicemounter/DeviceHandler.hpp"
|
||||
#include "fileOps/fileOps.h"
|
||||
#include "gecko/wifi_gecko.hpp"
|
||||
#include "gui/text.hpp"
|
||||
#include "loader/fst.h"
|
||||
#include "loader/mload.h"
|
||||
#include "loader/wdvd.h"
|
||||
#include "loader/sys.h"
|
||||
#include "homebrew/homebrew.h"
|
||||
#include "memory/mem2.hpp"
|
||||
#include "network/FTP_Dir.hpp"
|
||||
#include "network/http.h"
|
||||
#include "plugin/crc32.h"
|
||||
|
||||
/* External WiiFlow Game Booter */
|
||||
the_CFG normalCFG;
|
||||
#define EXT_ADDR_CFG ((vu32*)0x90100000)
|
||||
#define EXT_ADDR ((u8*)0x90110000) //later for 0x80A80000
|
||||
#define LDR_ADDR ((u8*)0x93300000)
|
||||
#define LDR_ENTRY ((entry)LDR_ADDR)
|
||||
|
||||
u8 *extldr_ptr = NULL;
|
||||
size_t extldr_size = 0;
|
||||
|
||||
extern "C" {
|
||||
u8 configbytes[2];
|
||||
u32 hooktype;
|
||||
};
|
||||
|
||||
extern u8 *code_buf;
|
||||
extern u32 code_size;
|
||||
extern void *codelist;
|
||||
extern u8 *codelistend;
|
||||
extern u32 gameconfsize;
|
||||
extern u32 *gameconf;
|
||||
|
||||
u8 *booter_ptr = NULL;
|
||||
size_t booter_size = 0;
|
||||
|
||||
void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode,
|
||||
int aspectRatio, u32 returnTo, u8 BootType, bool use_led)
|
||||
{
|
||||
normalCFG.vidMode = vidMode;
|
||||
normalCFG.vipatch = vipatch;
|
||||
normalCFG.countryString = countryString;
|
||||
normalCFG.patchVidMode = patchVidMode;
|
||||
normalCFG.aspectRatio = aspectRatio;
|
||||
normalCFG.returnTo = returnTo;
|
||||
normalCFG.configbytes[0] = configbytes[0];
|
||||
normalCFG.configbytes[1] = configbytes[1];
|
||||
normalCFG.IOS = CurrentIOS;
|
||||
normalCFG.codelist = codelist;
|
||||
normalCFG.codelistend = codelistend;
|
||||
normalCFG.cheats = code_buf;
|
||||
normalCFG.cheatSize = code_size;
|
||||
normalCFG.hooktype = hooktype;
|
||||
normalCFG.debugger = debuggerselect;
|
||||
normalCFG.gameconf = gameconf;
|
||||
normalCFG.gameconfsize = gameconfsize;
|
||||
normalCFG.BootType = BootType;
|
||||
normalCFG.use_led = use_led;
|
||||
normalCFG.wip_list = get_wip_list();
|
||||
normalCFG.wip_count = get_wip_count();
|
||||
/* Copy CFG Into lower MEM1 so it doesnt get destroyed */
|
||||
DCFlushRange(&normalCFG, sizeof(the_CFG));
|
||||
the_CFG *lowCFG = (the_CFG*)MEM1_lo_alloc(sizeof(the_CFG));
|
||||
memcpy(lowCFG, &normalCFG, sizeof(the_CFG));
|
||||
DCFlushRange(&lowCFG, sizeof(the_CFG));
|
||||
*EXT_ADDR_CFG = ((u32)lowCFG);
|
||||
/* Unmount devices etc */
|
||||
ShutdownBeforeExit();
|
||||
/* Wii Games will need it */
|
||||
net_wc24cleanup();
|
||||
/* Set proper time */
|
||||
settime(secs_to_ticks(time(NULL) - 946684800));
|
||||
/* Copy in booter */
|
||||
memcpy(EXT_ADDR, booter_ptr, booter_size);
|
||||
DCFlushRange(EXT_ADDR, booter_size);
|
||||
/* Loader just for the booter */
|
||||
memcpy(LDR_ADDR, extldr_ptr, extldr_size);
|
||||
DCFlushRange(LDR_ADDR, extldr_size);
|
||||
/* Boot it */
|
||||
JumpToEntry(LDR_ENTRY);
|
||||
}
|
||||
|
||||
bool ExternalBooter_LoadBins(const char *binDir)
|
||||
{
|
||||
extldr_ptr = fsop_ReadFile(fmt("%s/ext_loader.bin", binDir), &extldr_size);
|
||||
if(extldr_size == 0 || extldr_ptr == NULL)
|
||||
return false;
|
||||
|
||||
booter_ptr = fsop_ReadFile(fmt("%s/ext_booter.bin", binDir), &booter_size);
|
||||
if(booter_size > 0 && booter_ptr != NULL)
|
||||
return true;
|
||||
|
||||
free(extldr_ptr);
|
||||
extldr_ptr = NULL;
|
||||
extldr_size = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
extern FragList *frag_list;
|
||||
extern s32 wbfsDev;
|
||||
extern u32 wbfs_part_idx;
|
||||
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, bool patchregion, bool private_server, const char *ID)
|
||||
{
|
||||
memset(&normalCFG, 0, sizeof(the_CFG));
|
||||
normalCFG.GameBootType = dvd ? TYPE_WII_DISC : (wbfs ? TYPE_WII_WBFS : TYPE_WII_WBFS_EXT);
|
||||
strncpy(normalCFG.gameID, ID, 6);
|
||||
normalCFG.fragments = frag_list;
|
||||
normalCFG.wbfsDevice = wbfsDev;
|
||||
normalCFG.wbfsPart = wbfs_part_idx;
|
||||
normalCFG.patchregion = patchregion;
|
||||
normalCFG.private_server = private_server;
|
||||
}
|
||||
|
||||
void ExternalBooter_ChannelSetup(u64 title, bool dol)
|
||||
{
|
||||
memset(&normalCFG, 0, sizeof(the_CFG));
|
||||
memcpy(&normalCFG.title, &title, sizeof(u64));
|
||||
normalCFG.use_dol = dol;
|
||||
}
|
||||
|
||||
void ShutdownBeforeExit(void)
|
||||
{
|
||||
DeviceHandle.UnMountAll();
|
||||
NandHandle.DeInit_ISFS();
|
||||
WDVD_Close();
|
||||
Close_Inputs();
|
||||
/* Deinit network */
|
||||
if(networkInit == true)
|
||||
{
|
||||
while(net_get_status() == -EBUSY)
|
||||
usleep(50);
|
||||
WiFiDebugger.Close();
|
||||
ftp_endTread();
|
||||
net_deinit();
|
||||
networkInit = false;
|
||||
}
|
||||
}
|
||||
|
@ -1,38 +1,38 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#ifndef EXTERNAL_BOOTER_HPP
|
||||
#define EXTERNAL_BOOTER_HPP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern u8 configbytes[2];
|
||||
extern u32 hooktype;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode,
|
||||
int aspectRatio, u32 returnTo, u8 BootType, bool use_led);
|
||||
bool ExternalBooter_LoadBins(const char *binDir);
|
||||
void ExternalBooter_ChannelSetup(u64 title, bool dol);
|
||||
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, bool patchregion, const char *ID);
|
||||
void ShutdownBeforeExit(void);
|
||||
|
||||
#endif
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#ifndef EXTERNAL_BOOTER_HPP
|
||||
#define EXTERNAL_BOOTER_HPP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern u8 configbytes[2];
|
||||
extern u32 hooktype;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode,
|
||||
int aspectRatio, u32 returnTo, u8 BootType, bool use_led);
|
||||
bool ExternalBooter_LoadBins(const char *binDir);
|
||||
void ExternalBooter_ChannelSetup(u64 title, bool dol);
|
||||
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, bool patchregion, bool private_server, const char *ID);
|
||||
void ShutdownBeforeExit(void);
|
||||
|
||||
#endif
|
||||
|
@ -85,27 +85,63 @@
|
||||
#define GBTN_1_HELD (gc_btnsHeld & GBTN_1)
|
||||
#define GBTN_2_HELD (gc_btnsHeld & GBTN_2)
|
||||
|
||||
#define BTN_UP_PRESSED (WBTN_UP_PRESSED || GBTN_UP_PRESSED)
|
||||
#define BTN_DOWN_PRESSED (WBTN_DOWN_PRESSED || GBTN_DOWN_PRESSED)
|
||||
#define BTN_LEFT_PRESSED (WBTN_LEFT_PRESSED || GBTN_LEFT_PRESSED)
|
||||
#define BTN_RIGHT_PRESSED (WBTN_RIGHT_PRESSED || GBTN_RIGHT_PRESSED)
|
||||
#define BTN_HOME_PRESSED (WBTN_HOME_PRESSED || GBTN_START_PRESSED)
|
||||
#define BTN_MINUS_PRESSED (WBTN_MINUS_PRESSED || GBTN_L_PRESSED)
|
||||
#define BTN_PLUS_PRESSED (WBTN_PLUS_PRESSED || GBTN_R_PRESSED)
|
||||
#define BTN_A_PRESSED (WBTN_A_PRESSED || GBTN_A_PRESSED)
|
||||
#define BTN_B_PRESSED (WBTN_B_PRESSED || GBTN_B_PRESSED)
|
||||
#define BTN_1_PRESSED (WBTN_1_PRESSED || GBTN_1_PRESSED)
|
||||
#define BTN_2_PRESSED (WBTN_2_PRESSED || GBTN_2_PRESSED)
|
||||
#define DBTN_PS (DS3_BUTTON_PS)
|
||||
#define DBTN_START (DS3_BUTTON_START)
|
||||
#define DBTN_SELECT (DS3_BUTTON_SELECT)
|
||||
#define DBTN_Y (DS3_BUTTON_TRIANGLE)
|
||||
#define DBTN_Z (DS3_BUTTON_CIRCLE)
|
||||
#define DBTN_B (DS3_BUTTON_CROSS)
|
||||
#define DBTN_A (DS3_BUTTON_SQUARE)
|
||||
#define DBTN_UP (DS3_BUTTON_UP)
|
||||
#define DBTN_RIGHT (DS3_BUTTON_RIGHT)
|
||||
#define DBTN_DOWN (DS3_BUTTON_DOWN)
|
||||
#define DBTN_LEFT (DS3_BUTTON_LEFT)
|
||||
#define DBTN_L1 (DS3_BUTTON_L1)
|
||||
#define DBTN_L2 (DS3_BUTTON_L2)
|
||||
#define DBTN_L3 (DS3_BUTTON_L3)
|
||||
#define DBTN_R1 (DS3_BUTTON_R1)
|
||||
#define DBTN_R2 (DS3_BUTTON_R2)
|
||||
#define DBTN_R3 (DS3_BUTTON_R3)
|
||||
|
||||
#define DBTN_PS_PRESSED (ds3_btnsPressed & DS3_BUTTON_PS)
|
||||
#define DBTN_START_PRESSED (ds3_btnsPressed & DS3_BUTTON_START)
|
||||
#define DBTN_SELECT_PRESSED (ds3_btnsPressed & DS3_BUTTON_SELECT)
|
||||
#define DBTN_Y_PRESSED (ds3_btnsPressed & DS3_BUTTON_TRIANGLE)
|
||||
#define DBTN_Z_PRESSED (ds3_btnsPressed & DS3_BUTTON_CIRCLE)
|
||||
#define DBTN_B_PRESSED (ds3_btnsPressed & DS3_BUTTON_CROSS)
|
||||
#define DBTN_A_PRESSED (ds3_btnsPressed & DS3_BUTTON_SQUARE)
|
||||
#define DBTN_UP_PRESSED (ds3_btnsPressed & DS3_BUTTON_UP)
|
||||
#define DBTN_RIGHT_PRESSED (ds3_btnsPressed & DS3_BUTTON_RIGHT)
|
||||
#define DBTN_DOWN_PRESSED (ds3_btnsPressed & DS3_BUTTON_DOWN)
|
||||
#define DBTN_LEFT_PRESSED (ds3_btnsPressed & DS3_BUTTON_LEFT)
|
||||
#define DBTN_L1_PRESSED (ds3_btnsPressed & DS3_BUTTON_L1)
|
||||
#define DBTN_L2_PRESSED (ds3_btnsPressed & DS3_BUTTON_L2)
|
||||
#define DBTN_L3_PRESSED (ds3_btnsPressed & DS3_BUTTON_L3)
|
||||
#define DBTN_R1_PRESSED (ds3_btnsPressed & DS3_BUTTON_R1)
|
||||
#define DBTN_R2_PRESSED (ds3_btnsPressed & DS3_BUTTON_R2)
|
||||
#define DBTN_R3_PRESSED (ds3_btnsPressed & DS3_BUTTON_R3)
|
||||
|
||||
#define BTN_UP_PRESSED (WBTN_UP_PRESSED || GBTN_UP_PRESSED || DBTN_UP_PRESSED)
|
||||
#define BTN_DOWN_PRESSED (WBTN_DOWN_PRESSED || GBTN_DOWN_PRESSED || DBTN_DOWN_PRESSED)
|
||||
#define BTN_LEFT_PRESSED (WBTN_LEFT_PRESSED || GBTN_LEFT_PRESSED || DBTN_LEFT_PRESSED)
|
||||
#define BTN_RIGHT_PRESSED (WBTN_RIGHT_PRESSED || GBTN_RIGHT_PRESSED || DBTN_RIGHT_PRESSED)
|
||||
#define BTN_HOME_PRESSED (WBTN_HOME_PRESSED || GBTN_START_PRESSED || DBTN_START_PRESSED)
|
||||
#define BTN_MINUS_PRESSED (WBTN_MINUS_PRESSED || GBTN_L_PRESSED || DBTN_L2_PRESSED)
|
||||
#define BTN_PLUS_PRESSED (WBTN_PLUS_PRESSED || GBTN_R_PRESSED || DBTN_R2_PRESSED)
|
||||
#define BTN_A_PRESSED (WBTN_A_PRESSED || GBTN_A_PRESSED || DBTN_A_PRESSED || DBTN_Z_PRESSED)
|
||||
#define BTN_B_PRESSED (WBTN_B_PRESSED || GBTN_B_PRESSED || DBTN_B_PRESSED)
|
||||
#define BTN_1_PRESSED (WBTN_1_PRESSED || GBTN_1_PRESSED || DBTN_L1_PRESSED)
|
||||
#define BTN_2_PRESSED (WBTN_2_PRESSED || GBTN_2_PRESSED || DBTN_R1_PRESSED)
|
||||
|
||||
#define BTN_UP_HELD (WBTN_UP_HELD || GBTN_UP_HELD)
|
||||
#define BTN_DOWN_HELD (WBTN_DOWN_HELD || GBTN_DOWN_HELD)
|
||||
#define BTN_LEFT_HELD (WBTN_LEFT_HELD || GBTN_LEFT_HELD)
|
||||
#define BTN_LEFT_HELD (WBTN_LEFT_HELD || GBTN_LEFT_HELD )
|
||||
#define BTN_RIGHT_HELD (WBTN_RIGHT_HELD || GBTN_RIGHT_HELD)
|
||||
#define BTN_HOME_HELD (WBTN_HOME_HELD || GBTN_START_HELD)
|
||||
#define BTN_MINUS_HELD (WBTN_MINUS_HELD || GBTN_L_HELD)
|
||||
#define BTN_PLUS_HELD (WBTN_PLUS_HELD || GBTN_R_HELD)
|
||||
#define BTN_A_HELD (WBTN_A_HELD || GBTN_A_HELD)
|
||||
#define BTN_B_HELD (WBTN_B_HELD || GBTN_B_HELD)
|
||||
#define BTN_B_HELD (WBTN_B_HELD || GBTN_B_HELD || DBTN_B_PRESSED || DBTN_Y_PRESSED)
|
||||
#define BTN_1_HELD (WBTN_1_HELD || GBTN_1_HELD)
|
||||
#define BTN_2_HELD (WBTN_2_HELD || GBTN_2_HELD)
|
||||
|
||||
@ -118,11 +154,11 @@ enum
|
||||
WBTN_A,
|
||||
};
|
||||
|
||||
#define BTN_UP_REPEAT (wii_btnRepeat(WBTN_UP) || gc_btnRepeat(GBTN_UP))
|
||||
#define BTN_DOWN_REPEAT (wii_btnRepeat(WBTN_DOWN) || gc_btnRepeat(GBTN_DOWN))
|
||||
#define BTN_LEFT_REPEAT (wii_btnRepeat(WBTN_LEFT) || gc_btnRepeat(GBTN_LEFT))
|
||||
#define BTN_RIGHT_REPEAT (wii_btnRepeat(WBTN_RIGHT) || gc_btnRepeat(GBTN_RIGHT))
|
||||
#define BTN_A_REPEAT (wii_btnRepeat(WBTN_A) || gc_btnRepeat(GBTN_A))
|
||||
#define BTN_UP_REPEAT (wii_btnRepeat(WBTN_UP) || gc_btnRepeat(GBTN_UP) || ds3_btnRepeat(DBTN_UP))
|
||||
#define BTN_DOWN_REPEAT (wii_btnRepeat(WBTN_DOWN) || gc_btnRepeat(GBTN_DOWN) || ds3_btnRepeat(DBTN_DOWN))
|
||||
#define BTN_LEFT_REPEAT (wii_btnRepeat(WBTN_LEFT) || gc_btnRepeat(GBTN_LEFT) || ds3_btnRepeat(DBTN_LEFT))
|
||||
#define BTN_RIGHT_REPEAT (wii_btnRepeat(WBTN_RIGHT) || gc_btnRepeat(GBTN_RIGHT) || ds3_btnRepeat(DBTN_RIGHT))
|
||||
#define BTN_A_REPEAT (wii_btnRepeat(WBTN_A) || gc_btnRepeat(GBTN_A) || ds3_btnRepeat(DBTN_A))
|
||||
|
||||
#define LEFT_STICK_UP lStick_Up()
|
||||
#define LEFT_STICK_DOWN lStick_Down()
|
||||
|
205
source/gc/gc.cpp
205
source/gc/gc.cpp
@ -25,7 +25,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "menu/menu.hpp"
|
||||
#include "gc/gc.hpp"
|
||||
#include "gui/text.hpp"
|
||||
#include "devicemounter/DeviceHandler.hpp"
|
||||
@ -147,40 +147,132 @@ void DML_New_WriteOptions()
|
||||
DCFlushRange((void *)(0x81200000), sizeof(DML_CFG));
|
||||
}
|
||||
|
||||
|
||||
// Nintendont
|
||||
NIN_CFG NinCfg;
|
||||
u8 NinDevice = 0;
|
||||
bool NinArgsboot = false;
|
||||
void Nintendont_SetOptions(const char *game, const char *gameID, u8 NMM, u8 videoSetting, bool widescreen)
|
||||
|
||||
void Nintendont_SetOptions(const char *game, const char *gameID, char *CheatPath,char *NewCheatPath, const char *partition,
|
||||
bool cheats, u8 NMM, u8 videomode, u8 videoSetting, bool widescreen, bool usb_hid, bool native_ctl, bool deflicker, bool screenshot, bool NIN_Debugger)
|
||||
{
|
||||
NinDevice = DeviceHandle.PathToDriveType(game);
|
||||
memset(&NinCfg, 0, sizeof(NIN_CFG));
|
||||
NinCfg.Magicbytes = 0x01070CF6;
|
||||
NinCfg.Version = NIN_CFG_VERSION;
|
||||
NinCfg.MaxPads = NIN_CFG_MAXPAD;
|
||||
|
||||
NinCfg.MemCardBlocks = 0x2;//251 blocks
|
||||
|
||||
//check version
|
||||
u32 NIN_cfg_version = NIN_CFG_VERSION;
|
||||
for(u8 i = SD; i < MAXDEVICES; ++i)
|
||||
{
|
||||
const char *dol_path = fmt(NIN_LOADER_PATH, DeviceName[i]);
|
||||
if(!fsop_FileExist(dol_path))
|
||||
continue;
|
||||
u32 filesize = 0;
|
||||
u8 *buffer = fsop_ReadFile(dol_path, &filesize);
|
||||
char NINversion[21];
|
||||
for(u32 i = 0; i < filesize-60; ++i)
|
||||
{
|
||||
// Nintendont Loader..Built : %s %s..Jan 10 2014.11:21:01
|
||||
if((*(vu32*)(buffer+i+2)) == 0x6e74656e && (*(vu32*)(buffer+i+6)) == 0x646f6e74
|
||||
&& (*(vu32*)(buffer+i+11)) == 0x4c6f6164) //'nten' 'dont' 'Load'
|
||||
{
|
||||
for(int k= 30; k <50; ++k)
|
||||
{
|
||||
if((*(vu32*)(buffer+i+k)) == 0x4A616E20 || (*(vu32*)(buffer+i+k)) == 0x46656220 ||
|
||||
(*(vu32*)(buffer+i+k)) == 0x4D617220 || (*(vu32*)(buffer+i+k)) == 0x41707220 ||
|
||||
(*(vu32*)(buffer+i+k)) == 0x4D617920 || (*(vu32*)(buffer+i+k)) == 0x4A756E20 ||
|
||||
(*(vu32*)(buffer+i+k)) == 0x4A756C20 || (*(vu32*)(buffer+i+k)) == 0x41756720 ||
|
||||
(*(vu32*)(buffer+i+k)) == 0x53657020 || (*(vu32*)(buffer+i+k)) == 0x4F637420 ||
|
||||
(*(vu32*)(buffer+i+k)) == 0x4E6F7620 || (*(vu32*)(buffer+i+k)) == 0x44656320 ) // find Month
|
||||
{
|
||||
for(int j = 0 ; j < 20 ; j++)
|
||||
NINversion[j] = *(u8*)(buffer+i+k+j);
|
||||
|
||||
NINversion[11] = ' '; // replace \0 between year and time with a space.
|
||||
NINversion[20] = 0;
|
||||
struct tm time;
|
||||
strptime(NINversion, "%b %d %Y %H:%M:%S", &time);
|
||||
|
||||
const time_t NINLoaderTime = mktime(&time);
|
||||
const time_t v135time = 1407167999;// v1.135
|
||||
|
||||
if(difftime(NINLoaderTime,v135time) > 0)
|
||||
NIN_cfg_version = 3;
|
||||
else
|
||||
NIN_cfg_version = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(buffer);
|
||||
break;
|
||||
}
|
||||
NinCfg.Version = NIN_cfg_version;
|
||||
|
||||
if(memcmp("0x474851",gameID,3)==0)
|
||||
NinCfg.MaxPads = 1;
|
||||
else
|
||||
NinCfg.MaxPads = 4;
|
||||
|
||||
NinCfg.Config |= NIN_CFG_AUTO_BOOT;
|
||||
|
||||
if(NinDevice != SD)
|
||||
NinCfg.Config |= NIN_CFG_USB;
|
||||
|
||||
if(IsOnWiiU() == true)
|
||||
{
|
||||
NinCfg.Config |= NIN_CFG_MEMCARDEMU;
|
||||
NinCfg.Config |= NIN_CFG_HID;
|
||||
}
|
||||
if(videoSetting == 0)
|
||||
NinCfg.VideoMode |= NIN_VID_NONE;
|
||||
else if(videoSetting == 1)
|
||||
NinCfg.VideoMode |= NIN_VID_AUTO;
|
||||
else
|
||||
|
||||
videoSetting = 2;
|
||||
if(videoSetting == 2)
|
||||
NinCfg.VideoMode |= NIN_VID_FORCE;
|
||||
|
||||
if((videomode > 3) && (videomode != 6))
|
||||
NinCfg.Config |= NIN_CFG_FORCE_PROG;
|
||||
|
||||
if(usb_hid)
|
||||
NinCfg.Config |= NIN_CFG_HID;
|
||||
|
||||
if(NIN_Debugger)
|
||||
NinCfg.Config |= NIN_CFG_OSREPORT;
|
||||
|
||||
if(native_ctl)
|
||||
NinCfg.Config |= NIN_CFG_NATIVE_SI;
|
||||
|
||||
if(deflicker)
|
||||
NinCfg.VideoMode |= NIN_VID_FORCE_DF;
|
||||
|
||||
if(screenshot)
|
||||
NinCfg.Config |= NIN_CFG_WIIU_WIDE;
|
||||
|
||||
if(widescreen)
|
||||
NinCfg.Config |= NIN_CFG_FORCE_WIDE;
|
||||
|
||||
if(NMM > 0)
|
||||
NinCfg.Config |= NIN_CFG_MEMCARDEMU;
|
||||
|
||||
if(NMM > 1)
|
||||
{
|
||||
NinCfg.Config |= NIN_CFG_MC_MULTI;
|
||||
NinCfg.MemCardBlocks = 0x4;//1019 blocks (8MB)
|
||||
}
|
||||
if(CheatPath != NULL && NewCheatPath != NULL && cheats)
|
||||
{
|
||||
const char *ptr = NULL;
|
||||
if(strncasecmp(CheatPath, partition, strlen(partition)) != 0)
|
||||
{
|
||||
fsop_CopyFile(CheatPath, NewCheatPath, NULL, NULL);
|
||||
ptr = strchr(NewCheatPath, '/');
|
||||
}
|
||||
else
|
||||
ptr = strchr(CheatPath, '/');
|
||||
snprintf(NinCfg.CheatPath,sizeof(NinCfg.CheatPath),ptr);
|
||||
NinCfg.Config |= NIN_CFG_CHEAT_PATH;
|
||||
}
|
||||
if(cheats)
|
||||
NinCfg.Config |= NIN_CFG_CHEATS;
|
||||
|
||||
strncpy(NinCfg.GamePath, strchr(game, '/'), 254);
|
||||
if(strstr(NinCfg.GamePath, "boot.bin") != NULL)
|
||||
{
|
||||
@ -191,11 +283,50 @@ void Nintendont_SetOptions(const char *game, const char *gameID, u8 NMM, u8 vide
|
||||
gprintf("Nintendont Game Path: %s, ID: %08x\n", NinCfg.GamePath, NinCfg.GameID);
|
||||
}
|
||||
|
||||
void Nintendont_BootDisc(u8 NMM, bool widescreen, bool usb_hid, bool native_ctl, bool deflicker)
|
||||
{
|
||||
memset(&NinCfg, 0, sizeof(NIN_CFG));
|
||||
NinCfg.Magicbytes = 0x01070CF6;
|
||||
FILE * location = fopen("sd:/nincfg.bin", "r");
|
||||
if(location == NULL)
|
||||
{
|
||||
NinCfg.Config |= NIN_CFG_USB;
|
||||
fclose(location);
|
||||
location = NULL;
|
||||
}
|
||||
NinCfg.Version = NIN_CFG_VERSION;
|
||||
NinCfg.Config |= NIN_CFG_AUTO_BOOT;
|
||||
NinCfg.VideoMode |= NIN_VID_AUTO;
|
||||
|
||||
if(usb_hid)
|
||||
NinCfg.Config |= NIN_CFG_HID;
|
||||
if(NMM == 1)
|
||||
{
|
||||
NinCfg.Config |= NIN_CFG_MEMCARDEMU;
|
||||
NinCfg.MemCardBlocks = 0x2;//251 blocks (2MB)
|
||||
}
|
||||
else if(NMM == 2)
|
||||
{
|
||||
NinCfg.Config |= NIN_CFG_MEMCARDEMU;
|
||||
NinCfg.Config |= NIN_CFG_MC_MULTI;
|
||||
NinCfg.MemCardBlocks = 0x4;//1019 blocks (8MB)
|
||||
|
||||
}
|
||||
if(native_ctl)
|
||||
NinCfg.Config |= NIN_CFG_NATIVE_SI;
|
||||
if(deflicker)
|
||||
NinCfg.VideoMode |= NIN_VID_FORCE_DF;
|
||||
if(widescreen)
|
||||
NinCfg.Config |= NIN_CFG_FORCE_WIDE;
|
||||
snprintf(NinCfg.GamePath,sizeof(NinCfg.GamePath),"di");
|
||||
}
|
||||
|
||||
void Nintendont_WriteOptions()
|
||||
{
|
||||
/* Newer Nintendont versions */
|
||||
if(NinArgsboot == true)
|
||||
{
|
||||
gprintf("Writing Arguments\n");
|
||||
AddBootArgument((char*)&NinCfg, sizeof(NIN_CFG));
|
||||
return;
|
||||
}
|
||||
@ -226,6 +357,7 @@ bool Nintendont_Installed()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Nintendont_GetLoader()
|
||||
{
|
||||
bool ret = false;
|
||||
@ -431,12 +563,15 @@ void GC_SetVideoMode(u8 videomode, u8 videoSetting, u8 loader)
|
||||
GXRModeObj *vmode = VIDEO_GetPreferredMode(0);
|
||||
int vmode_reg = 0;
|
||||
|
||||
if((VIDEO_HaveComponentCable() && (CONF_GetProgressiveScan() > 0)) || videomode > 3)
|
||||
if(loader == 2)
|
||||
videoSetting = 2;
|
||||
|
||||
if((VIDEO_HaveComponentCable() && (CONF_GetProgressiveScan() > 0)) || ((videomode > 3) && (videomode != 6)))
|
||||
sram->flags |= 0x80; //set progressive flag
|
||||
else
|
||||
sram->flags &= 0x7F; //clear progressive flag
|
||||
|
||||
if(videomode == 1 || videomode == 3 || videomode == 5)
|
||||
if(videomode == 1 || videomode == 3 || videomode == 5 || videomode == 6 || videomode == 7)
|
||||
{
|
||||
vmode_reg = 1;
|
||||
sram->flags |= 0x01; // Set bit 0 to set the video mode to PAL
|
||||
@ -447,7 +582,7 @@ void GC_SetVideoMode(u8 videomode, u8 videoSetting, u8 loader)
|
||||
sram->flags &= 0xFE; // Clear bit 0 to set the video mode to NTSC
|
||||
sram->ntd &= 0xBF; //clear pal60 flag
|
||||
}
|
||||
|
||||
|
||||
if(videomode == 1)
|
||||
{
|
||||
if(videoSetting == 2)
|
||||
@ -482,27 +617,51 @@ void GC_SetVideoMode(u8 videomode, u8 videoSetting, u8 loader)
|
||||
vmode = &TVEurgb60Hz480IntDf;
|
||||
vmode_reg = 5;
|
||||
}
|
||||
else if(videomode == 4 ||videomode == 6)
|
||||
else if(videomode == 4)
|
||||
{
|
||||
if(videoSetting == 2)
|
||||
{
|
||||
if(loader == 0)
|
||||
DMLCfg.VideoMode |= DML_VID_FORCE_PROG;
|
||||
else if(loader == 2)
|
||||
NinCfg.Config |= NIN_CFG_FORCE_PROG;
|
||||
NinCfg.VideoMode |= NIN_VID_FORCE_NTSC;
|
||||
}
|
||||
vmode = &TVNtsc480Prog;
|
||||
vmode = &TVNtsc480IntDf;// shouldn't this be vmode = &TVNtsc480Prog
|
||||
}
|
||||
else if(videomode == 5 || videomode == 7)
|
||||
else if(videomode == 5)
|
||||
{
|
||||
if(videoSetting == 2)
|
||||
{
|
||||
if(loader == 0)
|
||||
DMLCfg.VideoMode |= DML_VID_FORCE_PROG;
|
||||
else if(loader == 2)
|
||||
NinCfg.Config |= NIN_CFG_FORCE_PROG;
|
||||
NinCfg.VideoMode |= NIN_VID_FORCE_PAL60;
|
||||
}
|
||||
vmode = &TVNtsc480Prog;
|
||||
vmode = &TVEurgb60Hz480IntDf;
|
||||
vmode_reg = 5;
|
||||
}
|
||||
else if(videomode == 6)
|
||||
{
|
||||
if(videoSetting == 2)
|
||||
{
|
||||
if(loader == 0)
|
||||
DMLCfg.VideoMode |= DML_VID_FORCE_PAL60;
|
||||
else if(loader == 2)
|
||||
NinCfg.VideoMode |= NIN_VID_FORCE_MPAL;
|
||||
}
|
||||
vmode = &TVEurgb60Hz480IntDf;
|
||||
vmode_reg = 5;
|
||||
}
|
||||
else if(videomode == 7)
|
||||
{
|
||||
if(videoSetting == 2)
|
||||
{
|
||||
if(loader == 0)
|
||||
DMLCfg.VideoMode |= DML_VID_FORCE_PROG;
|
||||
else if(loader == 2)
|
||||
NinCfg.VideoMode |= NIN_VID_FORCE_MPAL;
|
||||
}
|
||||
vmode = &TVEurgb60Hz480IntDf;
|
||||
vmode_reg = 5;
|
||||
}
|
||||
|
||||
|
243
source/gc/gc.hpp
243
source/gc/gc.hpp
@ -1,120 +1,123 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#ifndef _GC_HPP_
|
||||
#define _GC_HPP_
|
||||
|
||||
#include <gccore.h>
|
||||
|
||||
// DIOS-MIOS
|
||||
#define DML_BOOT_PATH "sd:/games/boot.bin"
|
||||
|
||||
typedef struct DML_CFG
|
||||
{
|
||||
u32 Magicbytes; //0xD1050CF6
|
||||
u32 CfgVersion; //0x00000001
|
||||
u32 VideoMode;
|
||||
u32 Config;
|
||||
char GamePath[255];
|
||||
char CheatPath[255];
|
||||
} DML_CFG;
|
||||
|
||||
enum dmlconfig
|
||||
{
|
||||
DML_CFG_CHEATS = (1<<0),
|
||||
DML_CFG_DEBUGGER = (1<<1),
|
||||
DML_CFG_DEBUGWAIT = (1<<2),
|
||||
DML_CFG_NMM = (1<<3),
|
||||
DML_CFG_NMM_DEBUG = (1<<4),
|
||||
DML_CFG_GAME_PATH = (1<<5),
|
||||
DML_CFG_CHEAT_PATH = (1<<6),
|
||||
DML_CFG_ACTIVITY_LED= (1<<7),
|
||||
DML_CFG_PADHOOK = (1<<8),
|
||||
DML_CFG_NODISC_CFG1 = (1<<9),
|
||||
DML_CFG_FORCE_WIDE = (1<<9), //v2
|
||||
DML_CFG_BOOT_DISC = (1<<10),
|
||||
DML_CFG_BOOT_DOL = (1<<11), //v1
|
||||
DML_CFG_BOOT_DISC2 = (1<<11), //v2
|
||||
DML_CFG_NODISC_CFG2 = (1<<12),
|
||||
DML_CFG_SCREENSHOT = (1<<13),
|
||||
};
|
||||
|
||||
enum dmlvideomode
|
||||
{
|
||||
DML_VID_DML_AUTO = (0<<16),
|
||||
DML_VID_FORCE = (1<<16),
|
||||
DML_VID_NONE = (2<<16),
|
||||
|
||||
DML_VID_FORCE_PAL50 = (1<<0),
|
||||
DML_VID_FORCE_PAL60 = (1<<1),
|
||||
DML_VID_FORCE_NTSC = (1<<2),
|
||||
DML_VID_FORCE_PROG = (1<<3),
|
||||
DML_VID_PROG_PATCH = (1<<4),
|
||||
};
|
||||
|
||||
void DML_New_SetOptions(const char *GamePath, char *CheatPath, const char *NewCheatPath,
|
||||
const char *partition, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode,
|
||||
u8 videoSetting, bool widescreen, bool new_dm_cfg, bool activity_led, bool screenshot);
|
||||
void DML_Old_SetOptions(const char *GamePath);
|
||||
void DML_New_SetBootDiscOption(bool new_dm_cfg);
|
||||
void DML_New_WriteOptions();
|
||||
|
||||
|
||||
// Nintendont
|
||||
#include "nin_cfg.h"
|
||||
#define NIN_CFG_PATH "nincfg.bin"
|
||||
#define NIN_LOADER_PATH "%s:/apps/Nintendont/boot.dol"
|
||||
|
||||
bool Nintendont_Installed();
|
||||
bool Nintendont_GetLoader();
|
||||
void Nintendont_SetOptions(const char *game, const char *gameID, u8 NMM, u8 videoSetting, bool widescreen);
|
||||
void Nintendont_WriteOptions();
|
||||
|
||||
// Devolution
|
||||
#define DEVO_LOADER_PATH "%s/loader.bin"
|
||||
|
||||
typedef struct global_config
|
||||
{
|
||||
u32 signature;
|
||||
u16 version;
|
||||
u16 device_signature;
|
||||
u32 memcard_cluster;
|
||||
u32 disc1_cluster;
|
||||
u32 disc2_cluster;
|
||||
u32 options;
|
||||
} gconfig;
|
||||
|
||||
// constant value for identification purposes
|
||||
#define DEVO_CONFIG_SIG 0x3EF9DB23
|
||||
// version may change when future options are added
|
||||
#define DEVO_CONFIG_VERSION 0x0110
|
||||
// option flags
|
||||
#define DEVO_CONFIG_WIFILOG (1<<0)
|
||||
#define DEVO_CONFIG_WIDE (1<<1)
|
||||
#define DEVO_CONFIG_NOLED (1<<2)
|
||||
|
||||
bool DEVO_Installed(const char *path);
|
||||
void DEVO_GetLoader(const char *path);
|
||||
void DEVO_SetOptions(const char *isopath, const char *gameID,
|
||||
bool memcard_emum, bool widescreen, bool activity_led, bool wifi);
|
||||
void DEVO_Boot();
|
||||
|
||||
|
||||
// General
|
||||
void GC_SetVideoMode(u8 videomode, u8 videoSetting, u8 loader);
|
||||
void GC_SetLanguage(u8 lang, u8 loader);
|
||||
|
||||
#endif //_GC_HPP_
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2012 FIX94
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#ifndef _GC_HPP_
|
||||
#define _GC_HPP_
|
||||
|
||||
#include <gccore.h>
|
||||
|
||||
// DIOS-MIOS
|
||||
#define DML_BOOT_PATH "sd:/games/boot.bin"
|
||||
|
||||
typedef struct DML_CFG
|
||||
{
|
||||
u32 Magicbytes; //0xD1050CF6
|
||||
u32 CfgVersion; //0x00000001
|
||||
u32 VideoMode;
|
||||
u32 Config;
|
||||
char GamePath[255];
|
||||
char CheatPath[255];
|
||||
} DML_CFG;
|
||||
|
||||
enum dmlconfig
|
||||
{
|
||||
DML_CFG_CHEATS = (1<<0),
|
||||
DML_CFG_DEBUGGER = (1<<1),
|
||||
DML_CFG_DEBUGWAIT = (1<<2),
|
||||
DML_CFG_NMM = (1<<3),
|
||||
DML_CFG_NMM_DEBUG = (1<<4),
|
||||
DML_CFG_GAME_PATH = (1<<5),
|
||||
DML_CFG_CHEAT_PATH = (1<<6),
|
||||
DML_CFG_ACTIVITY_LED= (1<<7),
|
||||
DML_CFG_PADHOOK = (1<<8),
|
||||
DML_CFG_NODISC_CFG1 = (1<<9),
|
||||
DML_CFG_FORCE_WIDE = (1<<9), //v2
|
||||
DML_CFG_BOOT_DISC = (1<<10),
|
||||
DML_CFG_BOOT_DOL = (1<<11), //v1
|
||||
DML_CFG_BOOT_DISC2 = (1<<11), //v2
|
||||
DML_CFG_NODISC_CFG2 = (1<<12),
|
||||
DML_CFG_SCREENSHOT = (1<<13),
|
||||
};
|
||||
|
||||
enum dmlvideomode
|
||||
{
|
||||
DML_VID_DML_AUTO = (0<<16),
|
||||
DML_VID_FORCE = (1<<16),
|
||||
DML_VID_NONE = (2<<16),
|
||||
|
||||
DML_VID_FORCE_PAL50 = (1<<0),
|
||||
DML_VID_FORCE_PAL60 = (1<<1),
|
||||
DML_VID_FORCE_NTSC = (1<<2),
|
||||
DML_VID_FORCE_PROG = (1<<3),
|
||||
DML_VID_PROG_PATCH = (1<<4),
|
||||
};
|
||||
|
||||
void DML_New_SetOptions(const char *GamePath, char *CheatPath, const char *NewCheatPath,
|
||||
const char *partition, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode,
|
||||
u8 videoSetting, bool widescreen, bool new_dm_cfg, bool activity_led, bool screenshot);
|
||||
void DML_Old_SetOptions(const char *GamePath);
|
||||
void DML_New_SetBootDiscOption(bool new_dm_cfg);
|
||||
void DML_New_WriteOptions();
|
||||
|
||||
|
||||
// Nintendont
|
||||
#include "nin_cfg.h"
|
||||
#define NIN_CFG_PATH "nincfg.bin"
|
||||
#define NIN_LOADER_PATH "%s:/apps/nintendont/boot.dol"
|
||||
//const char *NINversionDate(NIN_LOADER_PATH);
|
||||
|
||||
bool Nintendont_Installed();
|
||||
bool Nintendont_GetLoader();
|
||||
void Nintendont_BootDisc(u8 NMM, bool widescreen, bool usb_hid, bool native_ctl, bool deflicker);
|
||||
void Nintendont_SetOptions(const char *game, const char *gameID, char *CheatPath, char *NewCheatPath, const char *partition,
|
||||
bool cheats, u8 NMM, u8 videomode, u8 videoSetting, bool widescreen, bool usb_hid, bool native_ctl, bool deflicker, bool screenshot, bool NIN_Debugger);
|
||||
void Nintendont_WriteOptions();
|
||||
|
||||
// Devolution
|
||||
#define DEVO_LOADER_PATH "%s/loader.bin"
|
||||
|
||||
typedef struct global_config
|
||||
{
|
||||
u32 signature;
|
||||
u16 version;
|
||||
u16 device_signature;
|
||||
u32 memcard_cluster;
|
||||
u32 disc1_cluster;
|
||||
u32 disc2_cluster;
|
||||
u32 options;
|
||||
} gconfig;
|
||||
|
||||
// constant value for identification purposes
|
||||
#define DEVO_CONFIG_SIG 0x3EF9DB23
|
||||
// version may change when future options are added
|
||||
#define DEVO_CONFIG_VERSION 0x0110
|
||||
// option flags
|
||||
#define DEVO_CONFIG_WIFILOG (1<<0)
|
||||
#define DEVO_CONFIG_WIDE (1<<1)
|
||||
#define DEVO_CONFIG_NOLED (1<<2)
|
||||
|
||||
bool DEVO_Installed(const char *path);
|
||||
void DEVO_GetLoader(const char *path);
|
||||
void DEVO_SetOptions(const char *isopath, const char *gameID,
|
||||
bool memcard_emum, bool widescreen, bool activity_led, bool wifi);
|
||||
void DEVO_Boot();
|
||||
|
||||
|
||||
// General
|
||||
void GC_SetVideoMode(u8 videomode, u8 videoSetting, u8 loader);
|
||||
void GC_SetLanguage(u8 lang, u8 loader);
|
||||
|
||||
#endif //_GC_HPP_
|
||||
|
@ -2,9 +2,13 @@
|
||||
#ifndef __COMMON_CONFIG_H__
|
||||
#define __COMMON_CONFIG_H__
|
||||
|
||||
#define NIN_CFG_VERSION 0x00000002
|
||||
|
||||
#define NIN_CFG_VERSION 0x00000003
|
||||
#define OLD_NIN_CFG_VERSION 0x00000002
|
||||
#define NIN_CFG_MAXPAD 4
|
||||
#define MEM_CARD_MAX (5)
|
||||
#define MEM_CARD_CODE(x) (1<<(x+2))
|
||||
#define MEM_CARD_SIZE(x) (1<<(x+19))
|
||||
#define MEM_CARD_BLOCKS(x) ((1<<(x+6))-5)
|
||||
|
||||
typedef struct NIN_CFG
|
||||
{
|
||||
@ -17,6 +21,7 @@ typedef struct NIN_CFG
|
||||
char CheatPath[255];
|
||||
unsigned int MaxPads;
|
||||
unsigned int GameID;
|
||||
unsigned int MemCardBlocks;
|
||||
} NIN_CFG;
|
||||
|
||||
enum ninconfig
|
||||
@ -32,6 +37,11 @@ enum ninconfig
|
||||
NIN_CFG_HID = (1<<8),
|
||||
NIN_CFG_OSREPORT = (1<<9),
|
||||
NIN_CFG_USB = (1<<10),
|
||||
NIN_CFG_LED = (1<<11),
|
||||
NIN_CFG_LOG = (1<<12),
|
||||
NIN_CFG_MC_MULTI = (1<<13),
|
||||
NIN_CFG_NATIVE_SI = (1<<14),
|
||||
NIN_CFG_WIIU_WIDE = (1<<15),
|
||||
};
|
||||
|
||||
enum ninvideomode
|
||||
@ -39,8 +49,9 @@ enum ninvideomode
|
||||
NIN_VID_AUTO = (0<<16),
|
||||
NIN_VID_FORCE = (1<<16),
|
||||
NIN_VID_NONE = (2<<16),
|
||||
NIN_VID_FORCE_DF = (4<<16),
|
||||
|
||||
NIN_VID_MASK = NIN_VID_AUTO|NIN_VID_FORCE|NIN_VID_NONE,
|
||||
NIN_VID_MASK = NIN_VID_AUTO|NIN_VID_FORCE|NIN_VID_NONE|NIN_VID_FORCE_DF,
|
||||
|
||||
NIN_VID_FORCE_PAL50 = (1<<0),
|
||||
NIN_VID_FORCE_PAL60 = (1<<1),
|
||||
@ -75,7 +86,4 @@ enum VideoModes
|
||||
GCVideoModePROG = 3,
|
||||
};
|
||||
|
||||
#define NIN_RAW_MEMCARD_SIZE 2*1024*1024 //2MB
|
||||
#define NIN_MEMCARD_BLOCKS 0x00000010 //251 Blocks
|
||||
|
||||
#endif
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <ogc/pad.h>
|
||||
#include "wiiuse/wpad.h"
|
||||
#include "wupc/wupc.h"
|
||||
#include "sicksaxis-wrapper/sicksaxis-wrapper.h"
|
||||
|
||||
#include "video.hpp"
|
||||
#include "FreeTypeGX.h"
|
||||
|
@ -1,226 +1,229 @@
|
||||
|
||||
#include <ogc/machine/processor.h>
|
||||
#include <ogc/lwp_threads.h>
|
||||
#include <ogc/lwp_watchdog.h>
|
||||
#include <stdio.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fs.h"
|
||||
#include "mload.h"
|
||||
#include "sys.h"
|
||||
#include "channel/channel_launcher.h"
|
||||
#include "loader/nk.h"
|
||||
#include "gecko/gecko.hpp"
|
||||
#include "memory/mem2.hpp"
|
||||
#include "memory/memory.h"
|
||||
#include "wiiuse/wpad.h"
|
||||
#include "wupc/wupc.h"
|
||||
|
||||
/* Variables */
|
||||
bool reset = false;
|
||||
bool shutdown = false;
|
||||
volatile u8 ExitOption = 0;
|
||||
const char *NeekPath = NULL;
|
||||
char wii_games_dir[64];
|
||||
|
||||
void __Wpad_PowerCallback()
|
||||
{
|
||||
shutdown = 1;
|
||||
}
|
||||
|
||||
void Open_Inputs(void)
|
||||
{
|
||||
/* Initialize Wiimote subsystem */
|
||||
PAD_Init();
|
||||
WUPC_Init();
|
||||
WPAD_Init();
|
||||
|
||||
/* Set POWER button callback */
|
||||
WPAD_SetPowerButtonCallback(__Wpad_PowerCallback);
|
||||
WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR);
|
||||
WPAD_SetIdleTimeout(60 * 2); // idle after 2 minutes
|
||||
}
|
||||
|
||||
void Close_Inputs(void)
|
||||
{
|
||||
WUPC_Shutdown();
|
||||
|
||||
u32 cnt;
|
||||
|
||||
/* Disconnect Wiimotes */
|
||||
for(cnt = 0; cnt < 4; cnt++)
|
||||
WPAD_Disconnect(cnt);
|
||||
|
||||
/* Shutdown Wiimote subsystem */
|
||||
WPAD_Shutdown();
|
||||
}
|
||||
|
||||
bool Sys_Exiting(void)
|
||||
{
|
||||
DCFlushRange(&reset, 32);
|
||||
DCFlushRange(&shutdown, 32);
|
||||
return reset || shutdown;
|
||||
}
|
||||
|
||||
int Sys_GetExitTo(void)
|
||||
{
|
||||
return ExitOption;
|
||||
}
|
||||
void Sys_ExitTo(int option)
|
||||
{
|
||||
ExitOption = option;
|
||||
//magic word to force wii menu in priiloader.
|
||||
if(ExitOption == EXIT_TO_MENU)
|
||||
{
|
||||
*Priiloader_CFG1 = 0x50756E65;
|
||||
*Priiloader_CFG2 = 0x50756E65;
|
||||
}
|
||||
else if(ExitOption == EXIT_TO_PRIILOADER)
|
||||
{
|
||||
*Priiloader_CFG1 = 0x4461636F;
|
||||
*Priiloader_CFG2 = 0x4461636F;
|
||||
}
|
||||
else
|
||||
{
|
||||
*Priiloader_CFG1 = 0xFFFFFFFF;
|
||||
*Priiloader_CFG2 = 0xFFFFFFFF;
|
||||
}
|
||||
DCFlushRange((void*)Priiloader_CFG1, 4);
|
||||
DCFlushRange((void*)Priiloader_CFG2, 4);
|
||||
}
|
||||
|
||||
void Sys_Exit(void)
|
||||
{
|
||||
if(ExitOption == EXIT_TO_DISABLE)
|
||||
return;
|
||||
|
||||
/* Shutdown Inputs */
|
||||
Close_Inputs();
|
||||
/* Just shutdown console*/
|
||||
if(ExitOption == BUTTON_CALLBACK)
|
||||
SYS_ResetSystem(SYS_POWEROFF_STANDBY, 0, 0);
|
||||
|
||||
/* We wanna to boot sth */
|
||||
WII_Initialize();
|
||||
if(ExitOption == EXIT_TO_WFNK2O)
|
||||
Launch_nk(0x1000144574641LL, NeekPath, 0);
|
||||
else if(ExitOption == EXIT_TO_SMNK2O)
|
||||
Launch_nk(0, NeekPath, 0);
|
||||
else if(ExitOption == EXIT_TO_BOOTMII)
|
||||
IOS_ReloadIOS(0xfe);
|
||||
else if(ExitOption == EXIT_TO_HBC)
|
||||
{
|
||||
WII_LaunchTitle(HBC_LULZ);
|
||||
WII_LaunchTitle(HBC_108);
|
||||
WII_LaunchTitle(HBC_JODI);
|
||||
WII_LaunchTitle(HBC_HAXX);
|
||||
}
|
||||
/* else Return to Menu */
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void __Sys_ResetCallback(void)
|
||||
{
|
||||
reset = true;
|
||||
}
|
||||
|
||||
void __Sys_PowerCallback(void)
|
||||
{
|
||||
shutdown = true;
|
||||
}
|
||||
|
||||
void Sys_Init(void)
|
||||
{
|
||||
/* Set RESET/POWER button callback */
|
||||
SYS_SetResetCallback(__Sys_ResetCallback);
|
||||
SYS_SetPowerCallback(__Sys_PowerCallback);
|
||||
}
|
||||
|
||||
bool AHBRPOT_Patched(void)
|
||||
{
|
||||
return (*HW_AHBPROT == 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
/* WiiU Check by crediar, thanks */
|
||||
bool IsOnWiiU(void)
|
||||
{
|
||||
if((*HW_PROCESSOR >> 16) == 0xCAFE)
|
||||
{
|
||||
gprintf("vWii Mode\n");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Sys_SetNeekPath(const char *Path)
|
||||
{
|
||||
NeekPath = Path;
|
||||
}
|
||||
|
||||
bool ModeChecked = false;
|
||||
bool DolphinMode = false;
|
||||
bool Sys_DolphinMode(void)
|
||||
{
|
||||
if(ModeChecked)
|
||||
return DolphinMode;
|
||||
|
||||
/* Thanks to skidau for that code! */
|
||||
u32 ifpr11 = 0x12345678;
|
||||
u32 ifpr12 = 0x9abcdef0;
|
||||
u32 ofpr1 = 0x00000000;
|
||||
u32 ofpr2 = 0x00000000;
|
||||
asm volatile (
|
||||
"lwz 3,%[ifpr11]\n\t"
|
||||
"stw 3,8(1)\n\t"
|
||||
"lwz 3,%[ifpr12]\n\t"
|
||||
"stw 3,12(1)\n\t"
|
||||
|
||||
"lfd 1,8(1)\n\t"
|
||||
"frsqrte 1, 1\n\t"
|
||||
"stfd 1,8(1)\n\t"
|
||||
|
||||
"lwz 3,8(1)\n\t"
|
||||
"stw 3, %[ofpr1]\n\t"
|
||||
"lwz 3,12(1)\n\t"
|
||||
"stw 3, %[ofpr2]\n\t"
|
||||
|
||||
:
|
||||
[ofpr1]"=m" (ofpr1)
|
||||
,[ofpr2]"=m" (ofpr2)
|
||||
:
|
||||
[ifpr11]"m" (ifpr11)
|
||||
,[ifpr12]"m" (ifpr12)
|
||||
|
||||
);
|
||||
if(ofpr1 != 0x56cc62b2)
|
||||
{
|
||||
gprintf("Dolphin-Emu\n");
|
||||
DolphinMode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
gprintf("Real Wii\n");
|
||||
DolphinMode = false;
|
||||
}
|
||||
ModeChecked = true;
|
||||
return DolphinMode;
|
||||
}
|
||||
|
||||
bool hw_check = false;
|
||||
bool on_hw = false;
|
||||
bool Sys_HW_Access(void)
|
||||
{
|
||||
if(hw_check == true)
|
||||
return on_hw;
|
||||
|
||||
check_neek2o();
|
||||
on_hw = AHBRPOT_Patched() && (!Sys_DolphinMode() && !neek2o());
|
||||
hw_check = true;
|
||||
return on_hw;
|
||||
}
|
||||
|
||||
/* KILL IT */
|
||||
s32 __IOS_LoadStartupIOS() { return 0; }
|
||||
|
||||
#include <ogc/machine/processor.h>
|
||||
#include <ogc/lwp_threads.h>
|
||||
#include <ogc/lwp_watchdog.h>
|
||||
#include <stdio.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fs.h"
|
||||
#include "mload.h"
|
||||
#include "sys.h"
|
||||
#include "channel/channel_launcher.h"
|
||||
#include "loader/nk.h"
|
||||
#include "gecko/gecko.hpp"
|
||||
#include "memory/mem2.hpp"
|
||||
#include "memory/memory.h"
|
||||
#include "wiiuse/wpad.h"
|
||||
#include "wupc/wupc.h"
|
||||
#include "sicksaxis-wrapper/sicksaxis-wrapper.h"
|
||||
|
||||
/* Variables */
|
||||
bool reset = false;
|
||||
bool shutdown = false;
|
||||
volatile u8 ExitOption = 0;
|
||||
const char *NeekPath = NULL;
|
||||
char wii_games_dir[64];
|
||||
|
||||
void __Wpad_PowerCallback()
|
||||
{
|
||||
shutdown = 1;
|
||||
}
|
||||
|
||||
void Open_Inputs(void)
|
||||
{
|
||||
/* Initialize Wiimote subsystem */
|
||||
PAD_Init();
|
||||
WUPC_Init();
|
||||
WPAD_Init();
|
||||
DS3_Init();
|
||||
|
||||
/* Set POWER button callback */
|
||||
WPAD_SetPowerButtonCallback(__Wpad_PowerCallback);
|
||||
WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR);
|
||||
WPAD_SetIdleTimeout(60 * 2); // idle after 2 minutes
|
||||
}
|
||||
|
||||
void Close_Inputs(void)
|
||||
{
|
||||
WUPC_Shutdown();
|
||||
|
||||
u32 cnt;
|
||||
|
||||
/* Disconnect Wiimotes */
|
||||
for(cnt = 0; cnt < 4; cnt++)
|
||||
WPAD_Disconnect(cnt);
|
||||
|
||||
/* Shutdown Wiimote subsystem */
|
||||
WPAD_Shutdown();
|
||||
DS3_Cleanup();
|
||||
}
|
||||
|
||||
bool Sys_Exiting(void)
|
||||
{
|
||||
DCFlushRange(&reset, 32);
|
||||
DCFlushRange(&shutdown, 32);
|
||||
return reset || shutdown;
|
||||
}
|
||||
|
||||
int Sys_GetExitTo(void)
|
||||
{
|
||||
return ExitOption;
|
||||
}
|
||||
void Sys_ExitTo(int option)
|
||||
{
|
||||
ExitOption = option;
|
||||
//magic word to force wii menu in priiloader.
|
||||
if(ExitOption == EXIT_TO_MENU)
|
||||
{
|
||||
*Priiloader_CFG1 = 0x50756E65;
|
||||
*Priiloader_CFG2 = 0x50756E65;
|
||||
}
|
||||
else if(ExitOption == EXIT_TO_PRIILOADER)
|
||||
{
|
||||
*Priiloader_CFG1 = 0x4461636F;
|
||||
*Priiloader_CFG2 = 0x4461636F;
|
||||
}
|
||||
else
|
||||
{
|
||||
*Priiloader_CFG1 = 0xFFFFFFFF;
|
||||
*Priiloader_CFG2 = 0xFFFFFFFF;
|
||||
}
|
||||
DCFlushRange((void*)Priiloader_CFG1, 4);
|
||||
DCFlushRange((void*)Priiloader_CFG2, 4);
|
||||
}
|
||||
|
||||
void Sys_Exit(void)
|
||||
{
|
||||
if(ExitOption == EXIT_TO_DISABLE)
|
||||
return;
|
||||
|
||||
/* Shutdown Inputs */
|
||||
Close_Inputs();
|
||||
/* Just shutdown console*/
|
||||
if(ExitOption == BUTTON_CALLBACK)
|
||||
SYS_ResetSystem(SYS_POWEROFF_STANDBY, 0, 0);
|
||||
|
||||
/* We wanna to boot sth */
|
||||
WII_Initialize();
|
||||
if(ExitOption == EXIT_TO_WFNK2O)
|
||||
Launch_nk(0x1000144574641LL, NeekPath, 0);
|
||||
else if(ExitOption == EXIT_TO_SMNK2O)
|
||||
Launch_nk(0, NeekPath, 0);
|
||||
else if(ExitOption == EXIT_TO_BOOTMII)
|
||||
IOS_ReloadIOS(0xfe);
|
||||
else if(ExitOption == EXIT_TO_HBC)
|
||||
{
|
||||
WII_LaunchTitle(HBC_LULZ);
|
||||
WII_LaunchTitle(HBC_108);
|
||||
WII_LaunchTitle(HBC_JODI);
|
||||
WII_LaunchTitle(HBC_HAXX);
|
||||
}
|
||||
/* else Return to Menu */
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void __Sys_ResetCallback(void)
|
||||
{
|
||||
reset = true;
|
||||
}
|
||||
|
||||
void __Sys_PowerCallback(void)
|
||||
{
|
||||
shutdown = true;
|
||||
}
|
||||
|
||||
void Sys_Init(void)
|
||||
{
|
||||
/* Set RESET/POWER button callback */
|
||||
SYS_SetResetCallback(__Sys_ResetCallback);
|
||||
SYS_SetPowerCallback(__Sys_PowerCallback);
|
||||
}
|
||||
|
||||
bool AHBRPOT_Patched(void)
|
||||
{
|
||||
return (*HW_AHBPROT == 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
/* WiiU Check by crediar, thanks */
|
||||
bool IsOnWiiU(void)
|
||||
{
|
||||
if((*HW_PROCESSOR >> 16) == 0xCAFE)
|
||||
{
|
||||
gprintf("vWii Mode\n");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Sys_SetNeekPath(const char *Path)
|
||||
{
|
||||
NeekPath = Path;
|
||||
}
|
||||
|
||||
bool ModeChecked = false;
|
||||
bool DolphinMode = false;
|
||||
bool Sys_DolphinMode(void)
|
||||
{
|
||||
if(ModeChecked)
|
||||
return DolphinMode;
|
||||
|
||||
/* Thanks to skidau for that code! */
|
||||
u32 ifpr11 = 0x12345678;
|
||||
u32 ifpr12 = 0x9abcdef0;
|
||||
u32 ofpr1 = 0x00000000;
|
||||
u32 ofpr2 = 0x00000000;
|
||||
asm volatile (
|
||||
"lwz 3,%[ifpr11]\n\t"
|
||||
"stw 3,8(1)\n\t"
|
||||
"lwz 3,%[ifpr12]\n\t"
|
||||
"stw 3,12(1)\n\t"
|
||||
|
||||
"lfd 1,8(1)\n\t"
|
||||
"frsqrte 1, 1\n\t"
|
||||
"stfd 1,8(1)\n\t"
|
||||
|
||||
"lwz 3,8(1)\n\t"
|
||||
"stw 3, %[ofpr1]\n\t"
|
||||
"lwz 3,12(1)\n\t"
|
||||
"stw 3, %[ofpr2]\n\t"
|
||||
|
||||
:
|
||||
[ofpr1]"=m" (ofpr1)
|
||||
,[ofpr2]"=m" (ofpr2)
|
||||
:
|
||||
[ifpr11]"m" (ifpr11)
|
||||
,[ifpr12]"m" (ifpr12)
|
||||
|
||||
);
|
||||
if(ofpr1 != 0x56cc62b2)
|
||||
{
|
||||
gprintf("Dolphin-Emu\n");
|
||||
DolphinMode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
gprintf("Real Wii\n");
|
||||
DolphinMode = false;
|
||||
}
|
||||
ModeChecked = true;
|
||||
return DolphinMode;
|
||||
}
|
||||
|
||||
bool hw_check = false;
|
||||
bool on_hw = false;
|
||||
bool Sys_HW_Access(void)
|
||||
{
|
||||
if(hw_check == true)
|
||||
return on_hw;
|
||||
|
||||
check_neek2o();
|
||||
on_hw = AHBRPOT_Patched() && (!Sys_DolphinMode() && !neek2o());
|
||||
hw_check = true;
|
||||
return on_hw;
|
||||
}
|
||||
|
||||
/* KILL IT */
|
||||
s32 __IOS_LoadStartupIOS() { return 0; }
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "network/ftp.h"
|
||||
#include "network/gcard.h"
|
||||
#include "unzip/U8Archive.h"
|
||||
|
||||
#include "sicksaxis-wrapper/sicksaxis-wrapper.h"
|
||||
// Sounds
|
||||
extern const u8 click_wav[];
|
||||
extern const u32 click_wav_size;
|
||||
@ -246,7 +246,7 @@ void CMenu::init()
|
||||
m_allow_random = m_cfg.getBool("GENERAL", "allow_b_on_questionmark", true);
|
||||
m_multisource = m_cfg.getBool("GENERAL", "multisource", false);
|
||||
/* DIOS_MIOS stuff */
|
||||
if(m_cfg.getBool(GC_DOMAIN, "always_show_button", false))
|
||||
if(m_cfg.getBool(GC_DOMAIN, "always_show_button", true))
|
||||
{
|
||||
gprintf("Force enabling DML view\n");
|
||||
m_show_dml = true;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "plugin/plugin.hpp"
|
||||
#include "wiiuse/wpad.h"
|
||||
#include "wupc/wupc.h"
|
||||
#include "sicksaxis-wrapper/sicksaxis-wrapper.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -491,6 +492,15 @@ private:
|
||||
|
||||
s16 m_gameSettingsLblDM_Widescreen;
|
||||
s16 m_gameSettingsBtnDM_Widescreen;
|
||||
|
||||
s16 m_gameSettingsLblUSB_HID;
|
||||
s16 m_gameSettingsBtnUSB_HID;
|
||||
|
||||
s16 m_gameSettingsLblNATIVE_CTL;
|
||||
s16 m_gameSettingsBtnNATIVE_CTL;
|
||||
|
||||
s16 m_gameSettingsLblDeflicker;
|
||||
s16 m_gameSettingsBtnDeflicker;
|
||||
|
||||
s16 m_gameSettingsLblGCLoader;
|
||||
s16 m_gameSettingsLblGCLoader_Val;
|
||||
@ -508,6 +518,8 @@ private:
|
||||
s16 m_gameSettingsBtnVipatch;
|
||||
s16 m_gameSettingsLblCountryPatch;
|
||||
s16 m_gameSettingsBtnCountryPatch;
|
||||
s16 m_gameSettingsLblPrivateServer;
|
||||
s16 m_gameSettingsBtnPrivateServer;
|
||||
s16 m_gameSettingsLblManage;
|
||||
s16 m_gameSettingsBtnManage;
|
||||
s16 m_gameSettingsLblPatchVidModes;
|
||||
@ -543,7 +555,9 @@ private:
|
||||
s16 m_systemBtnBack;
|
||||
s16 m_systemLblTitle;
|
||||
s16 m_systemLblVersionTxt;
|
||||
s16 m_systemLblNINverTxt;
|
||||
s16 m_systemLblVersion;
|
||||
s16 m_systemLblNINver;
|
||||
s16 m_systemLblVersionRev;
|
||||
s16 m_systemLblUser[4];
|
||||
s16 m_systemBtnDownload;
|
||||
@ -609,6 +623,12 @@ private:
|
||||
u8 m_wpadUpDelay;
|
||||
u8 m_wpadADelay;
|
||||
//u8 m_wpadBDelay;
|
||||
u8 m_dpadLeftDelay;
|
||||
u8 m_dpadDownDelay;
|
||||
u8 m_dpadRightDelay;
|
||||
u8 m_dpadUpDelay;
|
||||
u8 m_dpadADelay;
|
||||
u8 m_dpadHDelay;
|
||||
|
||||
u8 m_padLeftDelay;
|
||||
u8 m_padDownDelay;
|
||||
@ -616,7 +636,7 @@ private:
|
||||
u8 m_padUpDelay;
|
||||
u8 m_padADelay;
|
||||
//u8 m_padBDelay;
|
||||
|
||||
u32 ds3_btnsPressed;
|
||||
u32 wii_btnsPressed[WPAD_MAX_WIIMOTES];
|
||||
u32 wii_btnsHeld[WPAD_MAX_WIIMOTES];
|
||||
bool wBtn_Pressed(int btn, u8 ext);
|
||||
@ -627,7 +647,7 @@ private:
|
||||
u32 gc_btnsHeld;
|
||||
u32 wupc_btnsPressed[WPAD_MAX_WIIMOTES];
|
||||
u32 wupc_btnsHeld[WPAD_MAX_WIIMOTES];
|
||||
|
||||
bool ds3_btnRepeat(s64 btn);
|
||||
bool m_show_pointer[WPAD_MAX_WIIMOTES];
|
||||
float left_stick_angle[WPAD_MAX_WIIMOTES];
|
||||
float left_stick_mag[WPAD_MAX_WIIMOTES];
|
||||
@ -1174,16 +1194,16 @@ private:
|
||||
static const SOption _GlobalVideoModes[6];
|
||||
static const SOption _VideoModes[7];
|
||||
|
||||
static const SOption _GlobalDMLvideoModes[6];
|
||||
static const SOption _GlobalDMLvideoModes[8];
|
||||
static const SOption _GlobalGClanguages[7];
|
||||
static const SOption _DMLvideoModes[7];
|
||||
static const SOption _DMLvideoModes[9];
|
||||
static const SOption _GClanguages[8];
|
||||
|
||||
static const SOption _NandEmu[2];
|
||||
static const SOption _SaveEmu[5];
|
||||
static const SOption _GlobalSaveEmu[4];
|
||||
static const SOption _AspectRatio[3];
|
||||
static const SOption _NMM[4];
|
||||
static const SOption _NMM[5];
|
||||
static const SOption _NoDVD[3];
|
||||
static const SOption _GlobalGCLoaders[3];
|
||||
static const SOption _GCLoader[4];
|
||||
|
@ -100,7 +100,7 @@ void CMenu::_showConfig3(void)
|
||||
i = min(max(0, m_cfg.getInt(GC_DOMAIN, "game_language", 0)), (int)ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1);
|
||||
m_btnMgr.setText(m_config3LblDMLLanguage, _t(CMenu::_GlobalGClanguages[i].id, CMenu::_GlobalGClanguages[i].text));
|
||||
}
|
||||
i = min(max(0, m_cfg.getInt(GC_DOMAIN, "default_loader", 0)), (int)ARRAY_SIZE(CMenu::_GlobalGCLoaders) - 1);
|
||||
i = min(max(0, m_cfg.getInt(GC_DOMAIN, "default_loader", 2)), (int)ARRAY_SIZE(CMenu::_GlobalGCLoaders) - 1);
|
||||
m_btnMgr.setText(m_config3LblDMLLoader, _t(CMenu::_GlobalGCLoaders[i].id, CMenu::_GlobalGCLoaders[i].text));
|
||||
|
||||
m_btnMgr.setText(m_config3BtnOcarina, m_cfg.getBool(_domainFromView(), "cheat", false) ? _t("on", L"On") : _t("off", L"Off"));
|
||||
@ -145,7 +145,7 @@ int CMenu::_config3(void)
|
||||
else if (m_btnMgr.selected(m_config3BtnDMLLoaderP) || m_btnMgr.selected(m_config3BtnDMLLoaderM))
|
||||
{
|
||||
s8 direction = m_btnMgr.selected(m_config3BtnDMLLoaderP) ? 1 : -1;
|
||||
m_cfg.setInt(GC_DOMAIN, "default_loader", (int)loopNum((u32)m_cfg.getInt(GC_DOMAIN, "default_loader", 0) + direction, ARRAY_SIZE(CMenu::_GlobalGCLoaders)));
|
||||
m_cfg.setInt(GC_DOMAIN, "default_loader", (int)loopNum((u32)m_cfg.getInt(GC_DOMAIN, "default_loader", 2) + direction, ARRAY_SIZE(CMenu::_GlobalGCLoaders)));
|
||||
_showConfig3();
|
||||
}
|
||||
else if (m_btnMgr.selected(m_config3BtnOcarina))
|
||||
@ -220,8 +220,8 @@ void CMenu::_textConfig3(void)
|
||||
{
|
||||
m_btnMgr.setText(m_config3LblGameVideo, _t("cfgb3", L"Default video mode"));
|
||||
m_btnMgr.setText(m_config3LblGameLanguage, _t("cfgb4", L"Default game language"));
|
||||
m_btnMgr.setText(m_config3LblDMLGameVideo, _t("cfgb5", L"Default DML video mode"));
|
||||
m_btnMgr.setText(m_config3LblDMLGameLanguage, _t("cfgb6", L"Default DML game language"));
|
||||
m_btnMgr.setText(m_config3LblDMLGameVideo, _t("cfgb5", L"Default GC video mode"));
|
||||
m_btnMgr.setText(m_config3LblDMLGameLanguage, _t("cfgb6", L"Default GC game language"));
|
||||
m_btnMgr.setText(m_config3LblDMLGameLoader, _t("cfgb2", L"Default GC game loader"));
|
||||
m_btnMgr.setText(m_config3LblOcarina, _t("cfgb1", L"Ocarina"));
|
||||
}
|
||||
|
@ -72,12 +72,20 @@ void CMenu::_hideGameSettings(bool instant)
|
||||
m_btnMgr.hide(m_gameSettingsBtnLaunchNK, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblOcarina, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnOcarina, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblUSB_HID, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnUSB_HID, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblNATIVE_CTL, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnNATIVE_CTL, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblDeflicker, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnDeflicker, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblCheat, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnCheat, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblVipatch, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnVipatch, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblCountryPatch, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnCountryPatch, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblPrivateServer, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnPrivateServer, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblManage, instant);
|
||||
m_btnMgr.hide(m_gameSettingsBtnManage, instant);
|
||||
m_btnMgr.hide(m_gameSettingsLblPatchVidModes, instant);
|
||||
@ -143,7 +151,7 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.show(m_gameSettingsBtnBack);
|
||||
m_btnMgr.show(m_gameSettingsLblTitle);
|
||||
|
||||
if(CoverFlow.getHdr()->type == TYPE_WII_GAME && _checkSave(string((const char *)CoverFlow.getHdr()->id), false))
|
||||
if(CoverFlow.getHdr()->type == TYPE_WII_GAME)
|
||||
g_numGCfPages = 5;
|
||||
else
|
||||
g_numGCfPages = 4;
|
||||
@ -228,6 +236,7 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.show(m_gameSettingsLblDebuggerV);
|
||||
m_btnMgr.show(m_gameSettingsBtnDebuggerP);
|
||||
m_btnMgr.show(m_gameSettingsBtnDebuggerM);
|
||||
|
||||
if(CoverFlow.getHdr()->type != TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblHooktype);
|
||||
@ -235,9 +244,15 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.show(m_gameSettingsBtnHooktypeM);
|
||||
m_btnMgr.show(m_gameSettingsBtnHooktypeP);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblDeflicker);
|
||||
m_btnMgr.show(m_gameSettingsBtnDeflicker);
|
||||
}
|
||||
|
||||
m_btnMgr.show(m_gameSettingsLblOcarina);
|
||||
m_btnMgr.show(m_gameSettingsBtnOcarina);
|
||||
|
||||
|
||||
m_btnMgr.show(m_gameSettingsLblCheat);
|
||||
m_btnMgr.show(m_gameSettingsBtnCheat);
|
||||
}
|
||||
@ -247,16 +262,18 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.hide(m_gameSettingsLblDebuggerV);
|
||||
m_btnMgr.hide(m_gameSettingsBtnDebuggerP);
|
||||
m_btnMgr.hide(m_gameSettingsBtnDebuggerM);
|
||||
if(CoverFlow.getHdr()->type != TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.hide(m_gameSettingsLblHooktype);
|
||||
m_btnMgr.hide(m_gameSettingsLblHooktypeVal);
|
||||
m_btnMgr.hide(m_gameSettingsBtnHooktypeM);
|
||||
m_btnMgr.hide(m_gameSettingsBtnHooktypeP);
|
||||
}
|
||||
|
||||
m_btnMgr.hide(m_gameSettingsLblHooktype);
|
||||
m_btnMgr.hide(m_gameSettingsLblHooktypeVal);
|
||||
m_btnMgr.hide(m_gameSettingsBtnHooktypeM);
|
||||
m_btnMgr.hide(m_gameSettingsBtnHooktypeP);
|
||||
|
||||
m_btnMgr.hide(m_gameSettingsLblDeflicker);
|
||||
m_btnMgr.hide(m_gameSettingsBtnDeflicker);
|
||||
|
||||
m_btnMgr.hide(m_gameSettingsLblOcarina);
|
||||
m_btnMgr.hide(m_gameSettingsBtnOcarina);
|
||||
|
||||
|
||||
m_btnMgr.hide(m_gameSettingsLblCheat);
|
||||
m_btnMgr.hide(m_gameSettingsBtnCheat);
|
||||
}
|
||||
@ -371,6 +388,7 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.show(m_gameSettingsLblEmulation);
|
||||
m_btnMgr.show(m_gameSettingsBtnEmulationP);
|
||||
m_btnMgr.show(m_gameSettingsBtnEmulationM);
|
||||
|
||||
if(_checkSave(string((const char *)CoverFlow.getHdr()->id), true))
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblExtractSave);
|
||||
@ -381,6 +399,12 @@ void CMenu::_showGameSettings(void)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblScreenshot);
|
||||
m_btnMgr.show(m_gameSettingsBtnScreenshot);
|
||||
|
||||
m_btnMgr.show(m_gameSettingsLblUSB_HID);
|
||||
m_btnMgr.show(m_gameSettingsBtnUSB_HID);
|
||||
|
||||
m_btnMgr.show(m_gameSettingsLblNATIVE_CTL);
|
||||
m_btnMgr.show(m_gameSettingsBtnNATIVE_CTL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -426,16 +450,28 @@ void CMenu::_showGameSettings(void)
|
||||
}
|
||||
m_btnMgr.hide(m_gameSettingsLblLED);
|
||||
m_btnMgr.hide(m_gameSettingsBtnLED);
|
||||
|
||||
m_btnMgr.hide(m_gameSettingsLblUSB_HID);
|
||||
m_btnMgr.hide(m_gameSettingsBtnUSB_HID);
|
||||
|
||||
m_btnMgr.hide(m_gameSettingsLblNATIVE_CTL);
|
||||
m_btnMgr.hide(m_gameSettingsBtnNATIVE_CTL);
|
||||
}
|
||||
if(m_gameSettingsPage == 5)
|
||||
{
|
||||
m_btnMgr.show(m_gameSettingsLblFlashSave);
|
||||
m_btnMgr.show(m_gameSettingsBtnFlashSave);
|
||||
|
||||
m_btnMgr.show(m_gameSettingsLblPrivateServer);
|
||||
m_btnMgr.show(m_gameSettingsBtnPrivateServer);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.hide(m_gameSettingsLblFlashSave);
|
||||
m_btnMgr.hide(m_gameSettingsBtnFlashSave);
|
||||
|
||||
m_btnMgr.hide(m_gameSettingsLblPrivateServer);
|
||||
m_btnMgr.hide(m_gameSettingsBtnPrivateServer);
|
||||
}
|
||||
u32 i = 0;
|
||||
for(i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i)
|
||||
@ -451,9 +487,12 @@ void CMenu::_showGameSettings(void)
|
||||
m_btnMgr.setText(m_gameSettingsBtnLED, _optBoolToString(m_gcfg2.getOptBool(id, "led", 0)));
|
||||
if(CoverFlow.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
m_btnMgr.setText(m_gameSettingsBtnDM_Widescreen, _optBoolToString(m_gcfg2.getOptBool(id, "dm_widescreen", 0)));
|
||||
m_btnMgr.setText(m_gameSettingsBtnDM_Widescreen, _optBoolToString(m_gcfg2.getOptBool(id, "dm_widescreen", m_cfg.getBool(GC_DOMAIN, "dm_widescreen", 0))));
|
||||
m_btnMgr.setText(m_gameSettingsBtnDevoMemcardEmu, _optBoolToString(m_gcfg2.getOptBool(id, "devo_memcard_emu", 0)));
|
||||
m_btnMgr.setText(m_gameSettingsBtnScreenshot, _optBoolToString(m_gcfg2.getOptBool(id, "screenshot", 0)));
|
||||
m_btnMgr.setText(m_gameSettingsBtnScreenshot, _optBoolToString(m_gcfg2.getOptBool(id, "screenshot", m_cfg.getBool(GC_DOMAIN, "screenshot", 0))));
|
||||
m_btnMgr.setText(m_gameSettingsBtnUSB_HID, _optBoolToString(m_gcfg2.getOptBool(id, "USB_HID", m_cfg.getBool(GC_DOMAIN, "USB_HID", 0))));
|
||||
m_btnMgr.setText(m_gameSettingsBtnNATIVE_CTL, _optBoolToString(m_gcfg2.getOptBool(id, "NATIVE_CTL", m_cfg.getBool(GC_DOMAIN, "NATIVE_CTL", 0))));
|
||||
m_btnMgr.setText(m_gameSettingsBtnDeflicker, _optBoolToString(m_gcfg2.getOptBool(id, "Deflicker", m_cfg.getBool(GC_DOMAIN, "Deflicker", 0))));
|
||||
i = min((u32)m_gcfg2.getInt(id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblDMLVideo, _t(CMenu::_DMLvideoModes[i].id, CMenu::_DMLvideoModes[i].text));
|
||||
i = min((u32)m_gcfg2.getInt(id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u);
|
||||
@ -469,6 +508,7 @@ void CMenu::_showGameSettings(void)
|
||||
{
|
||||
m_btnMgr.setText(m_gameSettingsBtnVipatch, _optBoolToString(m_gcfg2.getOptBool(id, "vipatch", 0)));
|
||||
m_btnMgr.setText(m_gameSettingsBtnCountryPatch, _optBoolToString(m_gcfg2.getOptBool(id, "country_patch", 0)));
|
||||
m_btnMgr.setText(m_gameSettingsBtnPrivateServer, _optBoolToString(m_gcfg2.getOptBool(id, "private_server", m_cfg.getBool(WII_DOMAIN, "private_server", 0))));
|
||||
m_btnMgr.setText(m_gameSettingsBtnIOSreloadBlock, _optBoolToString(m_gcfg2.getOptBool(id, "reload_block", 0)));
|
||||
i = min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_VideoModes) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblVideo, _t(CMenu::_VideoModes[i].id, CMenu::_VideoModes[i].text));
|
||||
@ -477,7 +517,7 @@ void CMenu::_showGameSettings(void)
|
||||
i = min((u32)m_gcfg2.getInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1u);
|
||||
m_btnMgr.setText(m_gameSettingsLblAspectRatioVal, _t(CMenu::_AspectRatio[i].id, CMenu::_AspectRatio[i].text));
|
||||
m_btnMgr.setText(m_gameSettingsBtnCustom, _optBoolToString(m_gcfg2.getOptBool(id, "custom", 0)));
|
||||
m_btnMgr.setText(m_gameSettingsBtnLaunchNK, _optBoolToString(m_gcfg2.getOptBool(id, "useneek", 0)));
|
||||
m_btnMgr.setText(m_gameSettingsBtnLaunchNK, _optBoolToString(m_gcfg2.getOptBool(id, "useneek", m_cfg.getBool(CHANNEL_DOMAIN, "useneek", 0))));
|
||||
m_btnMgr.setText(m_gameSettingsBtnApploader, _optBoolToString(m_gcfg2.getOptBool(id, "apploader", 0)));
|
||||
}
|
||||
|
||||
@ -624,7 +664,7 @@ void CMenu::_gameSettings(void)
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnNMM_P) || m_btnMgr.selected(m_gameSettingsBtnNMM_M))
|
||||
{
|
||||
s8 direction = m_btnMgr.selected(m_gameSettingsBtnNMM_P) ? 1 : -1;
|
||||
m_gcfg2.setInt(id, "dml_nmm", (int)loopNum((u32)m_gcfg2.getInt(id, "dml_nmm", 0) + direction, ARRAY_SIZE(CMenu::_NMM)));
|
||||
m_gcfg2.setInt(id, "dml_nmm", (int)loopNum((u32)m_gcfg2.getInt(id, "dml_nmm", 2) + direction, ARRAY_SIZE(CMenu::_NMM)));
|
||||
_showGameSettings();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnNoDVD_P) || m_btnMgr.selected(m_gameSettingsBtnNoDVD_M))
|
||||
@ -710,11 +750,31 @@ void CMenu::_gameSettings(void)
|
||||
m_gcfg2.setBool(id, "led", !m_gcfg2.getBool(id, "led", 0));
|
||||
_showGameSettings();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnNATIVE_CTL))
|
||||
{
|
||||
m_gcfg2.setBool(id, "NATIVE_CTL", !m_gcfg2.getBool(id, "NATIVE_CTL", 0));
|
||||
_showGameSettings();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnDeflicker))
|
||||
{
|
||||
m_gcfg2.setBool(id, "Deflicker", !m_gcfg2.getBool(id, "Deflicker", 0));
|
||||
_showGameSettings();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnScreenshot))
|
||||
{
|
||||
m_gcfg2.setBool(id, "screenshot", !m_gcfg2.getBool(id, "screenshot", 0));
|
||||
_showGameSettings();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnUSB_HID))
|
||||
{
|
||||
m_gcfg2.setBool(id, "USB_HID", !m_gcfg2.getBool(id, "USB_HID", 0));
|
||||
_showGameSettings();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnPrivateServer))
|
||||
{
|
||||
m_gcfg2.setBool(id, "private_server", !m_gcfg2.getBool(id, "private_server", 0));
|
||||
_showGameSettings();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_gameSettingsBtnCategoryMain) && !m_locked)
|
||||
{
|
||||
_hideGameSettings();
|
||||
@ -786,6 +846,9 @@ void CMenu::_initGameSettingsMenu()
|
||||
m_gameSettingsBtnHooktypeM = _addPicButton("GAME_SETTINGS/HOOKTYPE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 190, 48, 48);
|
||||
m_gameSettingsBtnHooktypeP = _addPicButton("GAME_SETTINGS/HOOKTYPE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 190, 48, 48);
|
||||
|
||||
m_gameSettingsLblDeflicker = _addLabel("GAME_SETTINGS/DEFLICKER", theme.lblFont, L"", 20, 185, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_gameSettingsBtnDeflicker = _addButton("GAME_SETTINGS/DEFLICKER_BTN", theme.btnFont, L"", 420, 190, 200, 48, theme.btnFontColor);
|
||||
|
||||
m_gameSettingsLblOcarina = _addLabel("GAME_SETTINGS/OCARINA", theme.lblFont, L"", 20, 245, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_gameSettingsBtnOcarina = _addButton("GAME_SETTINGS/OCARINA_BTN", theme.btnFont, L"", 420, 250, 200, 48, theme.btnFontColor);
|
||||
|
||||
@ -860,10 +923,20 @@ void CMenu::_initGameSettingsMenu()
|
||||
m_gameSettingsLblLED = _addLabel("GAME_SETTINGS/LED", theme.lblFont, L"", 20, 245, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_gameSettingsBtnLED = _addButton("GAME_SETTINGS/LED_BTN", theme.btnFont, L"", 420, 250, 200, 48, theme.btnFontColor);
|
||||
|
||||
m_gameSettingsLblUSB_HID = _addLabel("GAME_SETTINGS/USB_HID", theme.lblFont, L"", 20, 305, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_gameSettingsBtnUSB_HID = _addButton("GAME_SETTINGS/USB_HID_BTN", theme.btnFont, L"", 420, 310, 200, 48, theme.btnFontColor);
|
||||
|
||||
m_gameSettingsLblNATIVE_CTL = _addLabel("GAME_SETTINGS/NATIVE_CTL", theme.lblFont, L"", 20, 125, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_gameSettingsBtnNATIVE_CTL = _addButton("GAME_SETTINGS/NATIVE_CTL_BTN", theme.btnFont, L"", 420, 130, 200, 48, theme.btnFontColor);
|
||||
|
||||
//Page 5
|
||||
m_gameSettingsLblFlashSave = _addLabel("GAME_SETTINGS/FLASH_SAVE", theme.lblFont, L"", 20, 125, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_gameSettingsBtnFlashSave = _addButton("GAME_SETTINGS/FLASH_SAVE_BTN", theme.btnFont, L"", 420, 130, 200, 48, theme.btnFontColor);
|
||||
|
||||
m_gameSettingsLblPrivateServer = _addLabel("GAME_SETTINGS/PRIVATE_SERVER", theme.lblFont, L"", 20, 185, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_gameSettingsBtnPrivateServer = _addButton("GAME_SETTINGS/PRIVATE_SERVER_BTN", theme.btnFont, L"", 420, 190, 200, 48, theme.btnFontColor);
|
||||
|
||||
|
||||
//Footer
|
||||
m_gameSettingsLblPage = _addLabel("GAME_SETTINGS/PAGE_BTN", theme.btnFont, L"", 68, 400, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
||||
m_gameSettingsBtnPageM = _addPicButton("GAME_SETTINGS/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 48, 48);
|
||||
@ -908,6 +981,9 @@ void CMenu::_initGameSettingsMenu()
|
||||
_setHideAnim(m_gameSettingsLblCountryPatch, "GAME_SETTINGS/COUNTRY_PATCH", 50, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnCountryPatch, "GAME_SETTINGS/COUNTRY_PATCH_BTN", -50, 0, 1.f, 0.f);
|
||||
|
||||
_setHideAnim(m_gameSettingsLblPrivateServer, "GAME_SETTINGS/PRIVATE_SERVER", 50, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnPrivateServer, "GAME_SETTINGS/PRIVATE_SERVER_BTN", -50, 0, 1.f, 0.f);
|
||||
|
||||
_setHideAnim(m_gameSettingsLblVipatch, "GAME_SETTINGS/VIPATCH", 50, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnVipatch, "GAME_SETTINGS/VIPATCH_BTN", -50, 0, 1.f, 0.f);
|
||||
|
||||
@ -934,6 +1010,15 @@ void CMenu::_initGameSettingsMenu()
|
||||
|
||||
_setHideAnim(m_gameSettingsLblLED, "GAME_SETTINGS/LED", 50, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnLED, "GAME_SETTINGS/LED_BTN", -50, 0, 1.f, 0.f);
|
||||
|
||||
_setHideAnim(m_gameSettingsLblUSB_HID, "GAME_SETTINGS/USB_HID", 50, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnUSB_HID, "GAME_SETTINGS/USB_HID_BTN", -50, 0, 1.f, 0.f);
|
||||
|
||||
_setHideAnim(m_gameSettingsLblNATIVE_CTL, "GAME_SETTINGS/NATIVE_CTL", 50, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnNATIVE_CTL, "GAME_SETTINGS/NATIVE_CTL_BTN", -50, 0, 1.f, 0.f);
|
||||
|
||||
_setHideAnim(m_gameSettingsLblDeflicker, "GAME_SETTINGS/DEFLICKER", 50, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnDeflicker, "GAME_SETTINGS/DEFLICKER_BTN", -50, 0, 1.f, 0.f);
|
||||
|
||||
_setHideAnim(m_gameSettingsLblScreenshot, "GAME_SETTINGS/SCREENSHOT", 50, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_gameSettingsBtnScreenshot, "GAME_SETTINGS/SCREENSHOT_BTN", -50, 0, 1.f, 0.f);
|
||||
@ -1026,7 +1111,14 @@ void CMenu::_textGameSettings(void)
|
||||
m_btnMgr.setText(m_gameSettingsLblDM_Widescreen, _t("cfgg36", L"Widescreen Patch"));
|
||||
m_btnMgr.setText(m_gameSettingsLblApploader, _t("cfgg37", L"Boot Apploader"));
|
||||
m_btnMgr.setText(m_gameSettingsLblLED, _t("cfgg38", L"Activity LED"));
|
||||
m_btnMgr.setText(m_gameSettingsLblScreenshot, _t("cfgg39", L"DM Screenshot Feature"));
|
||||
if(IsOnWiiU() == true)
|
||||
m_btnMgr.setText(m_gameSettingsLblScreenshot, _t("cfgg39", L"WiiU Widescreen"));
|
||||
else
|
||||
m_btnMgr.setText(m_gameSettingsLblScreenshot, _t("cfgg39", L"DiosMios ScreenShot"));
|
||||
m_btnMgr.setText(m_gameSettingsLblManage, _t("cfgg40", L"Manage Cover and Banner"));
|
||||
m_btnMgr.setText(m_gameSettingsBtnManage, _t("cfgg41", L"Manage"));
|
||||
m_btnMgr.setText(m_gameSettingsLblUSB_HID, _t("cfgg42", L"Disable HDD Ping"));
|
||||
m_btnMgr.setText(m_gameSettingsLblNATIVE_CTL, _t("cfgg43", L"NATIVE Control"));
|
||||
m_btnMgr.setText(m_gameSettingsLblDeflicker, _t("cfgg44", L"Video Deflicker"));
|
||||
m_btnMgr.setText(m_gameSettingsLblPrivateServer, _t("cfgg45", L"Private Server"));
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ int CMenu::_configScreen(void)
|
||||
change = _configCommon();
|
||||
if (change != CONFIG_PAGE_NO_CHANGE)
|
||||
break;
|
||||
if (BTN_A_REPEAT)
|
||||
if (BTN_A_REPEAT || BTN_A_PRESSED)
|
||||
{
|
||||
if (m_btnMgr.selected(m_configScreenBtnTVWidthP) || m_btnMgr.selected(m_configScreenBtnTVWidthM)
|
||||
|| m_btnMgr.selected(m_configScreenBtnTVHeightP) || m_btnMgr.selected(m_configScreenBtnTVHeightM)
|
||||
|
@ -126,9 +126,9 @@ void CMenu::_CfgSrc(void)
|
||||
break;
|
||||
else if (m_btnMgr.selected(m_cfgsrcBtnEnableSM))
|
||||
{
|
||||
m_cfg.setBool("GENERAL", "use_source", !m_cfg.getBool("GENERAL", "use_source", false));
|
||||
m_btnMgr.setText(m_cfgsrcBtnEnableSM, m_cfg.getBool("GENERAL", "use_source", false) ? _t("on", L"On") : _t("off", L"Off"));
|
||||
m_use_source = m_cfg.getBool("GENERAL", "use_source", false);
|
||||
m_cfg.setBool("GENERAL", "use_source", !m_cfg.getBool("GENERAL", "use_source", true));
|
||||
m_btnMgr.setText(m_cfgsrcBtnEnableSM, m_cfg.getBool("GENERAL", "use_source", true) ? _t("on", L"On") : _t("off", L"Off"));
|
||||
m_use_source = m_cfg.getBool("GENERAL", "use_source", true);
|
||||
}
|
||||
else if (m_btnMgr.selected(m_cfgsrcBtnSourceOnBoot))
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ int CMenu::_configSnd(void)
|
||||
change = _configCommon();
|
||||
if (change != CONFIG_PAGE_NO_CHANGE)
|
||||
break;
|
||||
if (BTN_A_REPEAT)
|
||||
if (BTN_A_REPEAT || BTN_A_PRESSED)
|
||||
{
|
||||
if (m_btnMgr.selected(m_configSndBtnBnrVolP))
|
||||
{
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
#define TITLES_URL "http://www.gametdb.com/titles.txt?LANG=%s"
|
||||
#define GAMETDB_URL "http://www.gametdb.com/wiitdb.zip?LANG=%s&FALLBACK=TRUE&WIIWARE=TRUE&GAMECUBE=TRUE"
|
||||
#define UPDATE_URL_VERSION "http://dl.dropbox.com/u/25620767/WiiflowMod/versions.txt"
|
||||
#define CUSTOM_BANNER_URL "http://dl.dropboxusercontent.com/u/101209384/{gameid}.bnr"
|
||||
#define UPDATE_URL_VERSION "http://nintendont.gxarena.com/banners/versions.txt"
|
||||
#define CUSTOM_BANNER_URL "http://nintendont.gxarena.com/banners/{gameid}.bnr"
|
||||
|
||||
static const char FMT_BPIC_URL[] = "http://art.gametdb.com/{console}/coverfullHQ/{loc}/{gameid}.png"\
|
||||
"|http://art.gametdb.com/{console}/coverfull/{loc}/{gameid}.png";
|
||||
@ -1696,7 +1696,7 @@ s8 CMenu::_versionTxtDownloader() // code to download new version txt file
|
||||
m_thrdStep = 0.2f;
|
||||
m_thrdStepLen = 0.9f - 0.2f;
|
||||
gprintf("TXT update URL: %s\n\n", m_cfg.getString("GENERAL", "updatetxturl", UPDATE_URL_VERSION).c_str());
|
||||
download = downloadfile(buffer, bufferSize, m_cfg.getString("GENERAL", "updatetxturl", UPDATE_URL_VERSION).c_str(),CMenu::_downloadProgress, this);
|
||||
download = downloadfile(buffer, bufferSize, ("http://nintendont.gxarena.com/banners/versions.txt"),CMenu::_downloadProgress, this);
|
||||
if (download.data == 0 || download.size < 19)
|
||||
{
|
||||
LWP_MutexLock(m_mutex);
|
||||
@ -1788,7 +1788,8 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
}
|
||||
filestr.close();
|
||||
|
||||
u32 bufferSize = max(m_app_update_size, m_data_update_size); // Buffer for size of the biggest file.
|
||||
//u32 bufferSize = max(m_app_update_size, m_data_update_size); // Buffer for size of the biggest file.
|
||||
u32 bufferSize = 0x400000; /* 4mb max */
|
||||
u8 *buffer = (u8*)MEM2_alloc(bufferSize);
|
||||
if(buffer == NULL)
|
||||
{
|
||||
@ -1826,7 +1827,7 @@ s8 CMenu::_versionDownloader() // code to download new version
|
||||
gprintf("Data Update URL: %s\n", m_data_update_url);
|
||||
|
||||
download = downloadfile(buffer, bufferSize, m_app_update_url, CMenu::_downloadProgress, this);
|
||||
if (download.data == 0 || download.size < m_app_update_size)
|
||||
if (download.data == 0)// || download.size < m_app_update_size)
|
||||
{
|
||||
LWP_MutexLock(m_mutex);
|
||||
_setThrdMsg(_t("dlmsg12", L"Download failed!"), 1.f);
|
||||
|
@ -79,23 +79,27 @@ const CMenu::SOption CMenu::_VideoModes[7] = {
|
||||
{ "vidprog", L"Progressive" },
|
||||
};
|
||||
|
||||
const CMenu::SOption CMenu::_GlobalDMLvideoModes[6] = {
|
||||
const CMenu::SOption CMenu::_GlobalDMLvideoModes[8] = {
|
||||
{ "DMLdefG", L"Game" },
|
||||
{ "DMLpal", L"PAL 576i" },
|
||||
{ "DMLntsc", L"NTSC 480i" },
|
||||
{ "DMLpal60", L"PAL 480i" },
|
||||
{ "DMLprog", L"NTSC 480p" },
|
||||
{ "DMLprogP", L"PAL 480p" }
|
||||
{ "DMLprogP", L"PAL 480p" },
|
||||
{ "DMLmpal", L"MPAL" },
|
||||
{ "DMLmpalP", L"MPAL-P" }
|
||||
};
|
||||
|
||||
const CMenu::SOption CMenu::_DMLvideoModes[7] = {
|
||||
const CMenu::SOption CMenu::_DMLvideoModes[9] = {
|
||||
{ "DMLdef", L"Default" },
|
||||
{ "DMLdefG", L"Game" },
|
||||
{ "DMLpal", L"PAL 576i" },
|
||||
{ "DMLntsc", L"NTSC 480i" },
|
||||
{ "DMLpal60", L"PAL 480i" },
|
||||
{ "DMLprog", L"NTSC 480p" },
|
||||
{ "DMLprogP", L"PAL 480p" }
|
||||
{ "DMLprogP", L"PAL 480p" },
|
||||
{ "DMLmpal", L"MPAL" },
|
||||
{ "DMLmpalP", L"MPAL-P" }
|
||||
};
|
||||
|
||||
const CMenu::SOption CMenu::_GlobalGClanguages[7] = {
|
||||
@ -145,10 +149,11 @@ const CMenu::SOption CMenu::_AspectRatio[3] = {
|
||||
{ "aspect169", L"Force 16:9" },
|
||||
};
|
||||
|
||||
const CMenu::SOption CMenu::_NMM[4] = {
|
||||
const CMenu::SOption CMenu::_NMM[5] = {
|
||||
{ "NMMDef", L"Default" },
|
||||
{ "NMMOff", L"Disabled" },
|
||||
{ "NMMon", L"Enabled" },
|
||||
{ "NMMMulti", L"Multi Saves" },
|
||||
{ "NMMdebug", L"Debug" },
|
||||
};
|
||||
|
||||
@ -918,27 +923,22 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
}
|
||||
|
||||
u8 loader = min((u32)m_gcfg2.getInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u);
|
||||
loader = (loader == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "default_loader", 0), ARRAY_SIZE(CMenu::_GlobalGCLoaders) - 1u) : loader-1;
|
||||
loader = (loader == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "default_loader", 2), ARRAY_SIZE(CMenu::_GlobalGCLoaders) - 1u) : loader-1;
|
||||
bool memcard_emu = m_gcfg2.getBool(id, "devo_memcard_emu", false);
|
||||
bool widescreen = m_gcfg2.getBool(id, "dm_widescreen", false);
|
||||
bool activity_led = m_gcfg2.getBool(id, "led", false);
|
||||
bool usb_hid = m_gcfg2.getBool(id, "USB_HID", m_cfg.getBool(GC_DOMAIN, "USB_HID", false));
|
||||
bool native_ctl = m_gcfg2.getBool(id, "NATIVE_CTL", m_cfg.getBool(GC_DOMAIN, "NATIVE_CTL", false));
|
||||
bool deflicker = m_gcfg2.getBool(id, "Deflicker", m_cfg.getBool(GC_DOMAIN, "Deflicker", false));
|
||||
|
||||
if(loader == 2 && m_nintendont_installed == false)
|
||||
loader = 0;
|
||||
|
||||
//always enable for nintendont
|
||||
u8 NMM = (loader == 2) ? 2 : min((u32)m_gcfg2.getInt(id, "dml_nmm", 0), ARRAY_SIZE(CMenu::_NMM) - 1u);
|
||||
NMM = (NMM == 0) ? m_cfg.getInt(GC_DOMAIN, "dml_nmm", 0) : NMM-1;
|
||||
|
||||
//if GC disc use DIOS MIOS to launch it
|
||||
if(disc)
|
||||
{
|
||||
loader = 0;
|
||||
gprintf("Booting GC Disc: %s\n", id);
|
||||
}
|
||||
else
|
||||
m_cfg.setString(GC_DOMAIN, "current_item", id);
|
||||
u8 NMM = min((u32)m_gcfg2.getInt(id, "dml_nmm", m_cfg.getInt(GC_DOMAIN, "dml_nmm", 1)), ARRAY_SIZE(CMenu::_NMM) - 1u);
|
||||
NMM = (NMM == 0) ? m_cfg.getInt(GC_DOMAIN, "dml_nmm", 1) : NMM-1;
|
||||
|
||||
m_cfg.setString(GC_DOMAIN, "current_item", id);
|
||||
|
||||
if(loader == 0) //auto selected
|
||||
{
|
||||
@ -1017,7 +1017,15 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
}
|
||||
_launchShutdown();
|
||||
if(disc == true)
|
||||
DML_New_SetBootDiscOption(m_new_dm_cfg);
|
||||
{
|
||||
if(loader == 0)
|
||||
DML_New_SetBootDiscOption(m_new_dm_cfg);
|
||||
else if(loader == 2)
|
||||
{
|
||||
NMM = m_cfg.getInt(GC_DOMAIN, "dml_nmm", 1);
|
||||
Nintendont_BootDisc(NMM, widescreen, usb_hid, native_ctl, deflicker);
|
||||
}
|
||||
}
|
||||
else if(loader == 0)
|
||||
{
|
||||
char CheatPath[256];
|
||||
@ -1052,15 +1060,37 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
else if(loader == 1)
|
||||
DEVO_GetLoader(m_dataDir.c_str());
|
||||
else if(loader == 2)
|
||||
Nintendont_SetOptions(path, id, NMM, videoSetting, widescreen);
|
||||
|
||||
{
|
||||
bool NIN_Debugger = (m_gcfg2.getInt(id, "debugger", 0) == 2);
|
||||
bool screenshot = m_gcfg2.getBool(id, "screenshot", false);
|
||||
bool cheats = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(GC_DOMAIN, "cheat", false));
|
||||
/* Generate gct path */
|
||||
char GC_Path[256];
|
||||
GC_Path[255] = '\0';
|
||||
strncpy(GC_Path, path, 255);
|
||||
if(strcasestr(path, "boot.bin") != NULL)
|
||||
{
|
||||
*strrchr(GC_Path, '/') = '\0'; //boot.bin
|
||||
*(strrchr(GC_Path, '/')+1) = '\0'; //sys
|
||||
}
|
||||
else
|
||||
*(strrchr(GC_Path, '/')+1) = '\0'; //iso path
|
||||
//const char *NewPath = fmt("%s%s.gct", GC_Path, id);
|
||||
char CheatPath[256];
|
||||
char NewCheatPath[256];
|
||||
snprintf(CheatPath, sizeof(CheatPath), "%s/%s", m_cheatDir.c_str(), fmt("%s.gct", id));
|
||||
snprintf(NewCheatPath, sizeof(NewCheatPath), "%s%s.gct",GC_Path,id);
|
||||
|
||||
Nintendont_SetOptions(path, id, CheatPath,NewCheatPath,DeviceName[currentPartition],
|
||||
cheats, NMM, videoMode,videoSetting, widescreen,usb_hid,native_ctl,deflicker,screenshot,NIN_Debugger);
|
||||
}
|
||||
m_gcfg1.save(true);
|
||||
m_gcfg2.save(true);
|
||||
m_cat.save(true);
|
||||
m_cfg.save(true);
|
||||
cleanup();
|
||||
|
||||
GC_SetVideoMode(videoMode, (disc ? 1 : videoSetting), loader);
|
||||
|
||||
GC_SetVideoMode(videoMode, (disc ? 1 : videoSetting), loader);
|
||||
GC_SetLanguage(GClanguage, loader);
|
||||
/* NTSC-J Patch by FIX94 */
|
||||
if(id[3] == 'J')
|
||||
@ -1398,6 +1428,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
|
||||
bool vipatch = m_gcfg2.testOptBool(id, "vipatch", m_cfg.getBool("GENERAL", "vipatch", false));
|
||||
bool countryPatch = m_gcfg2.testOptBool(id, "country_patch", m_cfg.getBool("GENERAL", "country_patch", false));
|
||||
bool private_server = m_gcfg2.testOptBool(id, "private_server", m_cfg.getBool("GENERAL", "private_server", false));
|
||||
|
||||
u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u);
|
||||
u8 videoMode = (u8)min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_VideoModes) - 1u);
|
||||
@ -1568,7 +1599,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
free(gameconfig);
|
||||
}
|
||||
|
||||
ExternalBooter_WiiGameSetup(wbfs_partition, dvd, patchregion, id.c_str());
|
||||
ExternalBooter_WiiGameSetup(wbfs_partition, dvd, patchregion, private_server, id.c_str());
|
||||
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo, TYPE_WII_GAME, use_led);
|
||||
|
||||
Sys_Exit();
|
||||
|
@ -1,9 +1,14 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ogc\lwp_watchdog.h>
|
||||
|
||||
#include "menu.hpp"
|
||||
#include "sicksaxis-wrapper/sicksaxis-wrapper.h"
|
||||
|
||||
static const u32 g_repeatDelay = 25;
|
||||
u64 button_time = 0;
|
||||
|
||||
#define CheckTime() (ticks_to_millisecs(diff_ticks((button_time), gettick())) > 200)
|
||||
#define UpdateTime() button_time = gettick()
|
||||
|
||||
void CMenu::SetupInput(bool reset_pos)
|
||||
{
|
||||
@ -63,7 +68,8 @@ void CMenu::ScanInput()
|
||||
WUPC_UpdateButtonStats();
|
||||
WPAD_ScanPads();
|
||||
PAD_ScanPads();
|
||||
|
||||
DS3_ScanPads();
|
||||
|
||||
ButtonsPressed();
|
||||
ButtonsHeld();
|
||||
LeftStick();
|
||||
@ -103,9 +109,9 @@ void CMenu::ScanInput()
|
||||
}
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
m_btnMgr.setRumble(chan, WPadIR_Valid(chan), PAD_StickX(chan) < -20 || PAD_StickX(chan) > 20 || PAD_StickY(chan) < -20 || PAD_StickY(chan) > 20,
|
||||
WUPC_lStickX(chan) < -160 || WUPC_lStickX(chan) > 160 || WUPC_lStickY(chan) < -160 || WUPC_lStickY(chan) > 160);
|
||||
m_btnMgr.setMouse(WPadIR_Valid(chan) || m_show_pointer[chan]);
|
||||
m_btnMgr.setRumble(chan, WPadIR_Valid(chan), PAD_StickX(chan) < -20 || PAD_StickX(chan) > 20 || PAD_StickY(chan) < -20 || PAD_StickY(chan) > 20,
|
||||
WUPC_lStickX(chan) < -160 || WUPC_lStickX(chan) > 160 || WUPC_lStickY(chan) < -160 || WUPC_lStickY(chan) > 160);
|
||||
m_btnMgr.setMouse(WPadIR_Valid(chan) || m_show_pointer[chan]);
|
||||
if(WPadIR_Valid(chan))
|
||||
{
|
||||
m_cursor[chan].draw(wd[chan]->ir.x, wd[chan]->ir.y, wd[chan]->ir.angle);
|
||||
@ -124,15 +130,27 @@ void CMenu::ScanInput()
|
||||
ShowNextZone();
|
||||
ShowGameZone();
|
||||
}
|
||||
|
||||
extern "C" { extern bool shutdown; };
|
||||
void CMenu::ButtonsPressed()
|
||||
{
|
||||
|
||||
gc_btnsPressed = 0;
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
if (CheckTime())
|
||||
{
|
||||
wii_btnsPressed[chan] = WPAD_ButtonsDown(chan);
|
||||
gc_btnsPressed |= PAD_ButtonsDown(chan);
|
||||
wupc_btnsPressed[chan] = WUPC_ButtonsDown(chan);
|
||||
ds3_btnsPressed = DS3_ButtonsDown();
|
||||
UpdateTime();
|
||||
}
|
||||
else
|
||||
ds3_btnsPressed = 0;
|
||||
|
||||
if(ds3_btnsPressed & DBTN_SELECT) shutdown = 1;
|
||||
{
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
wii_btnsPressed[chan] = WPAD_ButtonsDown(chan);
|
||||
gc_btnsPressed |= PAD_ButtonsDown(chan);
|
||||
wupc_btnsPressed[chan] = WUPC_ButtonsDown(chan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,8 +167,7 @@ void CMenu::ButtonsHeld()
|
||||
|
||||
bool CMenu::wBtn_PressedChan(int btn, u8 ext, int &chan)
|
||||
{
|
||||
return ((wii_btnsPressed[chan] & btn) && (ext == WPAD_EXP_NONE || ext == wd[chan]->exp.type))
|
||||
|| ((wupc_btnsPressed[chan] & btn) && (ext == WPAD_EXP_CLASSIC));
|
||||
return ((wii_btnsPressed[chan] & btn) && (ext == WPAD_EXP_NONE || ext == wd[chan]->exp.type)) || ((wupc_btnsPressed[chan] & btn) && (ext == WPAD_EXP_CLASSIC));
|
||||
}
|
||||
|
||||
bool CMenu::wBtn_Pressed(int btn, u8 ext)
|
||||
@ -165,8 +182,7 @@ bool CMenu::wBtn_Pressed(int btn, u8 ext)
|
||||
|
||||
bool CMenu::wBtn_HeldChan(int btn, u8 ext, int &chan)
|
||||
{
|
||||
return ((wii_btnsHeld[chan] & btn) && (ext == WPAD_EXP_NONE || ext == wd[chan]->exp.type))
|
||||
|| ((wupc_btnsHeld[chan] & btn) && (ext == WPAD_EXP_CLASSIC));
|
||||
return ((wii_btnsHeld[chan] & btn) && (ext == WPAD_EXP_NONE || ext == wd[chan]->exp.type)) || ((wupc_btnsHeld[chan] & btn) && (ext == WPAD_EXP_CLASSIC));
|
||||
}
|
||||
|
||||
bool CMenu::wBtn_Held(int btn, u8 ext)
|
||||
@ -184,14 +200,13 @@ void CMenu::LeftStick()
|
||||
u8 speed = 0, pSpeed = 0;
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if(left_stick_mag[chan] > 0.15 || abs(PAD_StickX(chan)) > 20 || abs(PAD_StickY(chan)) > 20
|
||||
|| abs(WUPC_lStickX(chan)) > 160 || abs(WUPC_lStickY(chan)) > 160)
|
||||
if(left_stick_mag[chan] > 0.15 || abs(PAD_StickX(chan)) > 20 || abs(PAD_StickY(chan)) > 20 || (chan == 0 && (abs(DS3_StickX()) > 20 || abs(DS3_StickY()) > 20)) || abs(WUPC_lStickX(chan)) > 160 || abs(WUPC_lStickY(chan)) > 160)
|
||||
{
|
||||
m_show_pointer[chan] = true;
|
||||
if(LEFT_STICK_LEFT)
|
||||
{
|
||||
speed = (u8)(left_stick_mag[chan] * 10.00);
|
||||
pSpeed = (u8)(abs(PAD_StickX(chan))/10 | abs(WUPC_lStickX(chan))/80);
|
||||
pSpeed = (u8)((abs(PAD_StickX(chan))/10)|(abs(DS3_StickX()/10))|(abs(WUPC_lStickX(chan))/80));
|
||||
if(stickPointer_x[chan] > m_cursor[chan].width()/2)
|
||||
stickPointer_x[chan] = stickPointer_x[chan]-speed-pSpeed;
|
||||
pointerhidedelay[chan] = 150;
|
||||
@ -199,7 +214,7 @@ void CMenu::LeftStick()
|
||||
if(LEFT_STICK_DOWN)
|
||||
{
|
||||
speed = (u8)(left_stick_mag[chan] * 10.00);
|
||||
pSpeed = (u8)(abs(PAD_StickY(chan))/10 | abs(WUPC_lStickY(chan))/80);
|
||||
pSpeed = (u8)((abs(PAD_StickY(chan))/10)|(abs(DS3_StickY()/10))|(abs(WUPC_lStickY(chan))/80));
|
||||
if(stickPointer_y[chan] < (m_vid.height() + (m_cursor[chan].height()/2)))
|
||||
stickPointer_y[chan] = stickPointer_y[chan]+speed+pSpeed;
|
||||
pointerhidedelay[chan] = 150;
|
||||
@ -207,7 +222,7 @@ void CMenu::LeftStick()
|
||||
if(LEFT_STICK_RIGHT)
|
||||
{
|
||||
speed = (u8)(left_stick_mag[chan] * 10.00);
|
||||
pSpeed = (u8)(abs(PAD_StickX(chan))/10 | abs(WUPC_lStickX(chan))/80);
|
||||
pSpeed = (u8)((abs(PAD_StickX(chan))/10)|(abs(DS3_StickX()/10))|(abs(WUPC_lStickX(chan))/80));
|
||||
if(stickPointer_x[chan] < (m_vid.width() + (m_cursor[chan].width()/2)))
|
||||
stickPointer_x[chan] = stickPointer_x[chan]+speed+pSpeed;
|
||||
pointerhidedelay[chan] = 150;
|
||||
@ -215,7 +230,7 @@ void CMenu::LeftStick()
|
||||
if(LEFT_STICK_UP)
|
||||
{
|
||||
speed = (u8)(left_stick_mag[chan] * 10.00);
|
||||
pSpeed = (u8)(abs(PAD_StickY(chan))/10 | abs(WUPC_lStickY(chan))/80);
|
||||
pSpeed = (u8)((abs(PAD_StickY(chan))/10)|(abs(DS3_StickY()/10))|(abs(WUPC_lStickY(chan))/80));
|
||||
if(stickPointer_y[chan] > m_cursor[chan].height()/2)
|
||||
stickPointer_y[chan] = stickPointer_y[chan]-speed-pSpeed;
|
||||
pointerhidedelay[chan] = 150;
|
||||
@ -295,9 +310,9 @@ bool CMenu::wii_btnRepeat(u8 btn)
|
||||
else
|
||||
m_wpadDownDelay = 0;
|
||||
}
|
||||
else if(btn == WBTN_LEFT)
|
||||
else if(btn == WBTN_LEFT || DBTN_LEFT)
|
||||
{
|
||||
if(WBTN_LEFT_HELD)
|
||||
if(WBTN_LEFT_HELD || DBTN_LEFT_PRESSED)
|
||||
{
|
||||
if(m_wpadLeftDelay == 0 || m_wpadLeftDelay >= g_repeatDelay)
|
||||
b = true;
|
||||
@ -335,56 +350,56 @@ bool CMenu::gc_btnRepeat(s64 btn)
|
||||
{
|
||||
if(m_padUpDelay == 0 || m_padUpDelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_padUpDelay < g_repeatDelay)
|
||||
if(m_padUpDelay < g_repeatDelay)
|
||||
++m_padUpDelay;
|
||||
}
|
||||
else
|
||||
m_padUpDelay = 0;
|
||||
}
|
||||
else if (btn == GBTN_RIGHT)
|
||||
else if(btn == GBTN_RIGHT)
|
||||
{
|
||||
if(gc_btnsHeld & GBTN_RIGHT)
|
||||
{
|
||||
if(m_padRightDelay == 0 || m_padRightDelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_padRightDelay < g_repeatDelay)
|
||||
if(m_padRightDelay < g_repeatDelay)
|
||||
++m_padRightDelay;
|
||||
}
|
||||
else
|
||||
m_padRightDelay = 0;
|
||||
}
|
||||
else if (btn == GBTN_DOWN)
|
||||
else if(btn == GBTN_DOWN)
|
||||
{
|
||||
if(gc_btnsHeld & GBTN_DOWN)
|
||||
{
|
||||
if(m_padDownDelay == 0 || m_padDownDelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_padDownDelay < g_repeatDelay)
|
||||
if(m_padDownDelay < g_repeatDelay)
|
||||
++m_padDownDelay;
|
||||
}
|
||||
else
|
||||
m_padDownDelay = 0;
|
||||
}
|
||||
else if (btn == GBTN_LEFT)
|
||||
else if(btn == GBTN_LEFT)
|
||||
{
|
||||
if(gc_btnsHeld & GBTN_LEFT)
|
||||
{
|
||||
if(m_padLeftDelay == 0 || m_padLeftDelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_padLeftDelay < g_repeatDelay)
|
||||
if(m_padLeftDelay < g_repeatDelay)
|
||||
++m_padLeftDelay;
|
||||
}
|
||||
else
|
||||
m_padLeftDelay = 0;
|
||||
}
|
||||
else if (btn == GBTN_A)
|
||||
else if(btn == GBTN_A)
|
||||
{
|
||||
if(gc_btnsHeld & GBTN_A)
|
||||
{
|
||||
m_btnMgr.noClick(true);
|
||||
if(m_padADelay == 0 || m_padADelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_padADelay < g_repeatDelay)
|
||||
if(m_padADelay < g_repeatDelay)
|
||||
++m_padADelay;
|
||||
}
|
||||
else
|
||||
@ -396,11 +411,109 @@ bool CMenu::gc_btnRepeat(s64 btn)
|
||||
return b;
|
||||
}
|
||||
|
||||
bool CMenu::ds3_btnRepeat(s64 btn)
|
||||
{
|
||||
bool b = false;
|
||||
if(btn == DBTN_UP)
|
||||
{
|
||||
if(ds3_btnsPressed & DBTN_UP)
|
||||
{
|
||||
if(m_dpadUpDelay == 0 || m_dpadUpDelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_dpadUpDelay < g_repeatDelay)
|
||||
++m_dpadUpDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dpadUpDelay = 0;
|
||||
m_btnMgr.noClick();
|
||||
}
|
||||
}
|
||||
else if(btn == DBTN_RIGHT)
|
||||
{
|
||||
if(ds3_btnsPressed & DBTN_RIGHT)
|
||||
{
|
||||
if(m_dpadRightDelay == 0 || m_dpadRightDelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_dpadRightDelay < g_repeatDelay)
|
||||
++m_dpadRightDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dpadRightDelay = 0;
|
||||
m_btnMgr.noClick();
|
||||
}
|
||||
}
|
||||
else if(btn == DBTN_DOWN)
|
||||
{
|
||||
if(ds3_btnsPressed & DBTN_DOWN)
|
||||
{
|
||||
if(m_dpadDownDelay == 0 || m_dpadDownDelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_dpadDownDelay < g_repeatDelay)
|
||||
++m_dpadDownDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dpadDownDelay = 0;
|
||||
m_btnMgr.noClick();
|
||||
}
|
||||
}
|
||||
else if(btn == DBTN_LEFT)
|
||||
{
|
||||
if(ds3_btnsPressed & DBTN_LEFT)
|
||||
{
|
||||
if(m_dpadLeftDelay == 0 || m_dpadLeftDelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_dpadLeftDelay < g_repeatDelay)
|
||||
++m_dpadLeftDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dpadLeftDelay = 0;
|
||||
m_btnMgr.noClick();
|
||||
}
|
||||
}
|
||||
else if(btn == DBTN_A)
|
||||
{
|
||||
if(ds3_btnsPressed & DBTN_A)
|
||||
{
|
||||
m_btnMgr.noClick(true);
|
||||
if(m_dpadADelay == 1 || m_dpadADelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_dpadADelay < g_repeatDelay)
|
||||
++m_dpadADelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dpadADelay = 1;
|
||||
m_btnMgr.noClick();
|
||||
}
|
||||
}
|
||||
else if(btn == DBTN_START)
|
||||
{
|
||||
if(ds3_btnsPressed & DBTN_START)
|
||||
{
|
||||
m_btnMgr.noClick(true);
|
||||
if(m_dpadHDelay == 0.5 || m_dpadHDelay >= g_repeatDelay)
|
||||
b = true;
|
||||
if(m_dpadHDelay < g_repeatDelay)
|
||||
++m_dpadHDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dpadHDelay = 0.5;
|
||||
m_btnMgr.noClick();
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
bool CMenu::lStick_Up(void)
|
||||
{
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if((LEFT_STICK_ANG_UP && left_stick_mag[chan] > 0.15) || PAD_StickY(chan) > 20 || WUPC_lStickY(chan) > 160)
|
||||
if((LEFT_STICK_ANG_UP && left_stick_mag[chan] > 0.15) || PAD_StickY(chan) > 20 || DS3_StickY() < -20 || WUPC_lStickY(chan) > 160)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -410,7 +523,7 @@ bool CMenu::lStick_Right(void)
|
||||
{
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if((LEFT_STICK_ANG_RIGHT && left_stick_mag[chan] > 0.15) || PAD_StickX(chan) > 20 || WUPC_lStickX(chan) > 160)
|
||||
if((LEFT_STICK_ANG_RIGHT && left_stick_mag[chan] > 0.15) || PAD_StickX(chan) > 20 || DS3_StickX() > 20 || WUPC_lStickX(chan) > 160)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -420,7 +533,7 @@ bool CMenu::lStick_Down(void)
|
||||
{
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if((LEFT_STICK_ANG_DOWN && left_stick_mag[chan] > 0.15) || PAD_StickY(chan) < -20 || WUPC_lStickY(chan) < -160)
|
||||
if((LEFT_STICK_ANG_DOWN && left_stick_mag[chan] > 0.15) || PAD_StickY(chan) < -20 || DS3_StickY() > 20 || WUPC_lStickY(chan) < -160)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -430,7 +543,7 @@ bool CMenu::lStick_Left(void)
|
||||
{
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if((LEFT_STICK_ANG_LEFT && left_stick_mag[chan] > 0.15) || PAD_StickX(chan) < -20 || WUPC_lStickX(chan) < -160)
|
||||
if((LEFT_STICK_ANG_LEFT && left_stick_mag[chan] > 0.15) || PAD_StickX(chan) < -20 || DS3_StickX() < -20 || WUPC_lStickX(chan) < -160)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -440,8 +553,7 @@ bool CMenu::rStick_Up(void)
|
||||
{
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if((RIGHT_STICK_ANG_UP && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0)
|
||||
|| PAD_SubStickY(chan) > 20 || WUPC_rStickY(chan) > 160)
|
||||
if((RIGHT_STICK_ANG_UP && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickY(chan) > 20 || WUPC_rStickY(chan) > 160)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -451,8 +563,7 @@ bool CMenu::rStick_Right(void)
|
||||
{
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if((RIGHT_STICK_ANG_RIGHT && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0)
|
||||
|| PAD_SubStickX(chan) > 20 || WUPC_rStickX(chan) > 160)
|
||||
if((RIGHT_STICK_ANG_RIGHT && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickX(chan) > 20 || WUPC_rStickX(chan) > 160)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -462,8 +573,7 @@ bool CMenu::rStick_Down(void)
|
||||
{
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if((RIGHT_STICK_ANG_DOWN && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0)
|
||||
|| PAD_SubStickY(chan) < -20 || WUPC_rStickY(chan) < -160)
|
||||
if((RIGHT_STICK_ANG_DOWN && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickY(chan) < -20 || WUPC_rStickY(chan) < -160)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -473,8 +583,7 @@ bool CMenu::rStick_Left(void)
|
||||
{
|
||||
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
|
||||
{
|
||||
if((RIGHT_STICK_ANG_LEFT && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0)
|
||||
|| PAD_SubStickX(chan) < -20 || WUPC_rStickX(chan) < -160)
|
||||
if((RIGHT_STICK_ANG_LEFT && right_stick_mag[chan] > 0.15 && right_stick_skip[chan] == 0) || PAD_SubStickX(chan) < -20 || WUPC_rStickX(chan) < -160)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -248,7 +248,7 @@ int CMenu::main(void)
|
||||
bool dpad_mode = m_cfg.getBool("GENERAL", "dpad_mode", false);
|
||||
bool b_lr_mode = m_cfg.getBool("GENERAL", "b_lr_mode", false);
|
||||
bool use_grab = m_cfg.getBool("GENERAL", "use_grab", false);
|
||||
m_use_source = m_cfg.getBool("GENERAL", "use_source", false);
|
||||
m_use_source = m_cfg.getBool("GENERAL", "use_source", true);
|
||||
bool bheld = false;
|
||||
bool bUsed = false;
|
||||
|
||||
|
@ -109,8 +109,8 @@ void CMenu::_system()
|
||||
m_app_update_size = m_version.getInt("GENERAL", "app_zip_size", 0);
|
||||
m_data_update_size = m_version.getInt("GENERAL", "data_zip_size", 0);
|
||||
|
||||
m_app_update_url = fmt("%s/Wiiflow_Mod_svn_r%i.zip", m_version.getString("GENERAL", "update_url", "http://open-wiiflow-mod.googlecode.com/files").c_str(), newVer);
|
||||
m_data_update_url = fmt("%s/r%i/data.zip", m_version.getString("GENERAL", "update_url", "http://open-wiiflow-mod.googlecode.com/files").c_str(), newVer);
|
||||
m_app_update_url = fmt("%s/Mod%i.zip", ("http://nintendont.gxarena.com/banners"), newVer);
|
||||
m_data_update_url = fmt("%s/r%i/data.zip", ("http://nintendont.gxarena.com/banners"), newVer);
|
||||
|
||||
m_showtimer = 120;
|
||||
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_versionDownloaderInit,
|
||||
|
@ -1,228 +1,228 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ogc/lwp_watchdog.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "http.h"
|
||||
#include "gecko/gecko.hpp"
|
||||
|
||||
/**
|
||||
* Emptyblock is a statically defined variable for functions to return if they are unable
|
||||
* to complete a request
|
||||
*/
|
||||
const struct block emptyblock = {0, NULL};
|
||||
#define NET_BUFFER_SIZE 1024 //The maximum amount of bytes to send per net_write() call
|
||||
#define TCP_TIMEOUT 4000 // 4 secs to receive
|
||||
|
||||
// Write our message to the server
|
||||
static s32 send_message(s32 server, char *msg)
|
||||
{
|
||||
s32 bytes_transferred = 0, remaining = strlen(msg);
|
||||
s64 t = gettime();
|
||||
while (remaining)
|
||||
{
|
||||
if((bytes_transferred = net_write(server, msg, remaining > NET_BUFFER_SIZE ? NET_BUFFER_SIZE : remaining)) > 0)
|
||||
{
|
||||
remaining -= bytes_transferred;
|
||||
usleep (20 * 1000);
|
||||
t = gettime();
|
||||
}
|
||||
else if(bytes_transferred < 0) return bytes_transferred;
|
||||
|
||||
if(ticks_to_millisecs(diff_ticks(t, gettime())) > TCP_TIMEOUT)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a remote server via TCP on a specified port
|
||||
*
|
||||
* @param u32 ip address of the server to connect to
|
||||
* @param u32 the port to connect to on the server
|
||||
* @return s32 The connection to the server (negative number if connection could not be established)
|
||||
*/
|
||||
static s32 server_connect(u32 ipaddress, u32 socket_port)
|
||||
{
|
||||
//Initialize socket
|
||||
s32 connection = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
||||
if(connection < 0) return connection;
|
||||
|
||||
//Set the connection parameters for the socket
|
||||
struct sockaddr_in connect_addr;
|
||||
memset(&connect_addr, 0, sizeof(connect_addr));
|
||||
connect_addr.sin_family = AF_INET;
|
||||
connect_addr.sin_port = socket_port;
|
||||
connect_addr.sin_addr.s_addr= ipaddress;
|
||||
|
||||
//Attemt to open a connection on the socket
|
||||
if(net_connect(connection, (struct sockaddr*)&connect_addr, sizeof(connect_addr)) < 0)
|
||||
net_close(connection);
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
||||
//The amount of memory in bytes reserved initially to store the HTTP response in
|
||||
//Be careful in increasing this number, reading from a socket on the Wii
|
||||
#define HTTP_BUFFER_GROWTH 1024 * 5
|
||||
|
||||
/**
|
||||
* This function reads all the data from a connection into a buffer which it returns.
|
||||
* It will return an empty buffer if something doesn't go as planned
|
||||
*
|
||||
* @param s32 connection The connection identifier to suck the response out of
|
||||
* @return block A 'block' struct (see http.h) in which the buffer is located
|
||||
*/
|
||||
static struct block read_message(s32 connection, struct block buffer, bool (*f)(void *, int, int), void *ud)
|
||||
{
|
||||
static char tmpHdr[512];
|
||||
bool hdr = false, fail = true;
|
||||
u32 fileSize = 0, step = 0, offset = 0;
|
||||
s64 t = gettime();
|
||||
|
||||
//The offset variable always points to the first byte of memory that is free in the buffer
|
||||
while (true)
|
||||
{
|
||||
if(ticks_to_millisecs(diff_ticks(t, gettime())) > TCP_TIMEOUT || buffer.size <= offset)
|
||||
break;
|
||||
|
||||
//Fill the buffer with a new batch of bytes from the connection,
|
||||
//starting from where we left of in the buffer till the end of the buffer
|
||||
u32 len = buffer.size - offset;
|
||||
s32 bytes_read = net_read(connection, buffer.data + offset, len > HTTP_BUFFER_GROWTH ? HTTP_BUFFER_GROWTH : len);
|
||||
//Anything below 0 is an error in the connection
|
||||
if(bytes_read > 0)
|
||||
{
|
||||
t = gettime ();
|
||||
|
||||
offset += bytes_read;
|
||||
// Not enough memory
|
||||
if(buffer.size <= offset) return emptyblock;
|
||||
if(!hdr && offset >= sizeof tmpHdr)
|
||||
{
|
||||
hdr = true;
|
||||
memcpy(tmpHdr, buffer.data, sizeof tmpHdr - 1);
|
||||
tmpHdr[sizeof tmpHdr - 1] = 0;
|
||||
const char *p = strstr(tmpHdr, "Content-Length:");
|
||||
if(p != 0)
|
||||
{
|
||||
p += sizeof "Content-Length:";
|
||||
fileSize = strtol(p, 0, 10);
|
||||
}
|
||||
}
|
||||
if(step * HTTP_BUFFER_GROWTH < offset)
|
||||
{
|
||||
++step;
|
||||
if(f != 0)
|
||||
{
|
||||
if((fileSize != 0 && !f(ud, fileSize, offset <= fileSize ? offset : fileSize)) ||
|
||||
(fileSize == 0 && !f(ud, buffer.size, offset)))
|
||||
return emptyblock;
|
||||
}
|
||||
}
|
||||
fail = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bytes_read < 0) fail = true;
|
||||
break; // Need to translate the error messages here instead of just breaking.
|
||||
}
|
||||
}
|
||||
if(fail) return emptyblock;
|
||||
//At the end of above loop offset should be precisely the amount of bytes that were read from the connection
|
||||
buffer.size = offset;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/* Downloads the contents of a URL to memory
|
||||
* This method is not threadsafe (because networking is not threadsafe on the Wii) */
|
||||
struct block downloadfile(u8 *buffer, u32 bufferSize, const char *url, bool (*f)(void *, int, int), void *ud)
|
||||
{
|
||||
//Check if the url starts with "http://", if not it is not considered a valid url
|
||||
if(strncmp(url, "http://", strlen("http://")) != 0) return emptyblock;
|
||||
|
||||
//Locate the path part of the url by searching for '/' past "http://"
|
||||
char *path = strchr(url + strlen("http://"), '/');
|
||||
if(path == NULL) return emptyblock;
|
||||
|
||||
//Extract the domain part out of the url
|
||||
int domainlength = path - url - strlen("http://");
|
||||
if(domainlength == 0) return emptyblock;
|
||||
|
||||
char domain[domainlength + 1];
|
||||
strncpy(domain, url + strlen("http://"), domainlength);
|
||||
domain[domainlength] = '\0';
|
||||
|
||||
//Parsing of the URL is done, start making an actual connection
|
||||
u32 ipaddress = getipbynamecached(domain);
|
||||
if(ipaddress == 0) return emptyblock;
|
||||
|
||||
s32 connection = server_connect(ipaddress, 80);
|
||||
if(connection < 0) return emptyblock;
|
||||
|
||||
//Form a nice request header to send to the webserver
|
||||
char* headerformat = "GET %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: WiiFlow 2.1\r\n\r\n";;
|
||||
char header[strlen(headerformat) + strlen(domain) + strlen(path)];
|
||||
sprintf(header, headerformat, path, domain);
|
||||
|
||||
//Do the request and get the response
|
||||
send_message(connection, header);
|
||||
if (bufferSize == 0) return emptyblock;
|
||||
struct block buf;
|
||||
buf.data = buffer;
|
||||
buf.size = bufferSize;
|
||||
struct block response = read_message(connection, buf, f, ud);
|
||||
net_close(connection);
|
||||
|
||||
//Search for the 4-character sequence \r\n\r\n in the response which signals the start of the http payload (file)
|
||||
unsigned char *filestart = NULL;
|
||||
u32 filesize = 0;
|
||||
u32 i;
|
||||
for(i = 3; i < response.size; i++)
|
||||
{
|
||||
if(response.data[i] == '\n' &&
|
||||
response.data[i-1] == '\r' &&
|
||||
response.data[i-2] == '\n' &&
|
||||
response.data[i-3] == '\r')
|
||||
{
|
||||
filestart = response.data + i + 1;
|
||||
filesize = response.size - i - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(response.size == 0 || response.data == NULL) return emptyblock;
|
||||
|
||||
// Check for the headers
|
||||
char httpCode[3];
|
||||
memcpy(httpCode, &response.data[9], 3);
|
||||
int retCode = atoi(httpCode);
|
||||
|
||||
switch(retCode)
|
||||
{
|
||||
case 301:
|
||||
case 302:
|
||||
case 307: // Moved
|
||||
/*
|
||||
{
|
||||
char redirectedTo[255];
|
||||
if(findHeader((char *) response.data, (filestart - response.data), "Location", redirectedTo, 255) == 0) {
|
||||
return downloadfile(buffer, bufferSize, (char *) redirectedTo, f, ud);
|
||||
}
|
||||
return emptyblock;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case 404: // Error, file not found!
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
if(filestart == NULL) return emptyblock;
|
||||
|
||||
//Copy the file part of the response into a new memoryblock to return
|
||||
struct block file;
|
||||
file.data = filestart;
|
||||
file.size = filesize;
|
||||
return file;
|
||||
}
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ogc/lwp_watchdog.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "http.h"
|
||||
#include "gecko/gecko.hpp"
|
||||
|
||||
/**
|
||||
* Emptyblock is a statically defined variable for functions to return if they are unable
|
||||
* to complete a request
|
||||
*/
|
||||
const struct block emptyblock = {0, NULL};
|
||||
#define NET_BUFFER_SIZE 1024 //The maximum amount of bytes to send per net_write() call
|
||||
#define TCP_TIMEOUT 4000 // 4 secs to receive
|
||||
|
||||
// Write our message to the server
|
||||
static s32 send_message(s32 server, char *msg)
|
||||
{
|
||||
s32 bytes_transferred = 0, remaining = strlen(msg);
|
||||
s64 t = gettime();
|
||||
while (remaining)
|
||||
{
|
||||
if((bytes_transferred = net_write(server, msg, remaining > NET_BUFFER_SIZE ? NET_BUFFER_SIZE : remaining)) > 0)
|
||||
{
|
||||
remaining -= bytes_transferred;
|
||||
usleep (20 * 1000);
|
||||
t = gettime();
|
||||
}
|
||||
else if(bytes_transferred < 0) return bytes_transferred;
|
||||
|
||||
if(ticks_to_millisecs(diff_ticks(t, gettime())) > TCP_TIMEOUT)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a remote server via TCP on a specified port
|
||||
*
|
||||
* @param u32 ip address of the server to connect to
|
||||
* @param u32 the port to connect to on the server
|
||||
* @return s32 The connection to the server (negative number if connection could not be established)
|
||||
*/
|
||||
static s32 server_connect(u32 ipaddress, u32 socket_port)
|
||||
{
|
||||
//Initialize socket
|
||||
s32 connection = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
||||
if(connection < 0) return connection;
|
||||
|
||||
//Set the connection parameters for the socket
|
||||
struct sockaddr_in connect_addr;
|
||||
memset(&connect_addr, 0, sizeof(connect_addr));
|
||||
connect_addr.sin_family = AF_INET;
|
||||
connect_addr.sin_port = socket_port;
|
||||
connect_addr.sin_addr.s_addr= ipaddress;
|
||||
|
||||
//Attemt to open a connection on the socket
|
||||
if(net_connect(connection, (struct sockaddr*)&connect_addr, sizeof(connect_addr)) < 0)
|
||||
net_close(connection);
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
||||
//The amount of memory in bytes reserved initially to store the HTTP response in
|
||||
//Be careful in increasing this number, reading from a socket on the Wii
|
||||
#define HTTP_BUFFER_GROWTH 1024 * 5
|
||||
|
||||
/**
|
||||
* This function reads all the data from a connection into a buffer which it returns.
|
||||
* It will return an empty buffer if something doesn't go as planned
|
||||
*
|
||||
* @param s32 connection The connection identifier to suck the response out of
|
||||
* @return block A 'block' struct (see http.h) in which the buffer is located
|
||||
*/
|
||||
static struct block read_message(s32 connection, struct block buffer, bool (*f)(void *, int, int), void *ud)
|
||||
{
|
||||
static char tmpHdr[512];
|
||||
bool hdr = false, fail = true;
|
||||
u32 fileSize = 0, step = 0, offset = 0;
|
||||
s64 t = gettime();
|
||||
|
||||
//The offset variable always points to the first byte of memory that is free in the buffer
|
||||
while (true)
|
||||
{
|
||||
if(ticks_to_millisecs(diff_ticks(t, gettime())) > TCP_TIMEOUT || buffer.size <= offset)
|
||||
break;
|
||||
|
||||
//Fill the buffer with a new batch of bytes from the connection,
|
||||
//starting from where we left of in the buffer till the end of the buffer
|
||||
u32 len = buffer.size - offset;
|
||||
s32 bytes_read = net_read(connection, buffer.data + offset, len > HTTP_BUFFER_GROWTH ? HTTP_BUFFER_GROWTH : len);
|
||||
//Anything below 0 is an error in the connection
|
||||
if(bytes_read > 0)
|
||||
{
|
||||
t = gettime ();
|
||||
|
||||
offset += bytes_read;
|
||||
// Not enough memory
|
||||
if(buffer.size <= offset) return emptyblock;
|
||||
if(!hdr && offset >= sizeof tmpHdr)
|
||||
{
|
||||
hdr = true;
|
||||
memcpy(tmpHdr, buffer.data, sizeof tmpHdr - 1);
|
||||
tmpHdr[sizeof tmpHdr - 1] = 0;
|
||||
const char *p = strstr(tmpHdr, "Content-Length:");
|
||||
if(p != 0)
|
||||
{
|
||||
p += sizeof "Content-Length:";
|
||||
fileSize = strtol(p, 0, 10);
|
||||
}
|
||||
}
|
||||
if(step * HTTP_BUFFER_GROWTH < offset)
|
||||
{
|
||||
++step;
|
||||
if(f != 0)
|
||||
{
|
||||
if((fileSize != 0 && !f(ud, fileSize, offset <= fileSize ? offset : fileSize)) ||
|
||||
(fileSize == 0 && !f(ud, buffer.size, offset)))
|
||||
return emptyblock;
|
||||
}
|
||||
}
|
||||
fail = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bytes_read < 0) fail = true;
|
||||
break; // Need to translate the error messages here instead of just breaking.
|
||||
}
|
||||
}
|
||||
if(fail) return emptyblock;
|
||||
//At the end of above loop offset should be precisely the amount of bytes that were read from the connection
|
||||
buffer.size = offset;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/* Downloads the contents of a URL to memory
|
||||
* This method is not threadsafe (because networking is not threadsafe on the Wii) */
|
||||
struct block downloadfile(u8 *buffer, u32 bufferSize, const char *url, bool (*f)(void *, int, int), void *ud)
|
||||
{
|
||||
//Check if the url starts with "http://", if not it is not considered a valid url
|
||||
if(strncmp(url, "http://", strlen("http://")) != 0) return emptyblock;
|
||||
|
||||
//Locate the path part of the url by searching for '/' past "http://"
|
||||
char *path = strchr(url + strlen("http://"), '/');
|
||||
if(path == NULL) return emptyblock;
|
||||
|
||||
//Extract the domain part out of the url
|
||||
int domainlength = path - url - strlen("http://");
|
||||
if(domainlength == 0) return emptyblock;
|
||||
|
||||
char domain[domainlength + 1];
|
||||
strncpy(domain, url + strlen("http://"), domainlength);
|
||||
domain[domainlength] = '\0';
|
||||
|
||||
//Parsing of the URL is done, start making an actual connection
|
||||
u32 ipaddress = getipbynamecached(domain);
|
||||
if(ipaddress == 0) return emptyblock;
|
||||
|
||||
s32 connection = server_connect(ipaddress, 80);
|
||||
if(connection < 0) return emptyblock;
|
||||
|
||||
//Form a nice request header to send to the webserver
|
||||
char* headerformat = "GET %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0\r\n\r\n";;
|
||||
char header[strlen(headerformat) + strlen(domain) + strlen(path)];
|
||||
sprintf(header, headerformat, path, domain);
|
||||
|
||||
//Do the request and get the response
|
||||
send_message(connection, header);
|
||||
if (bufferSize == 0) return emptyblock;
|
||||
struct block buf;
|
||||
buf.data = buffer;
|
||||
buf.size = bufferSize;
|
||||
struct block response = read_message(connection, buf, f, ud);
|
||||
net_close(connection);
|
||||
|
||||
//Search for the 4-character sequence \r\n\r\n in the response which signals the start of the http payload (file)
|
||||
unsigned char *filestart = NULL;
|
||||
u32 filesize = 0;
|
||||
u32 i;
|
||||
for(i = 3; i < response.size; i++)
|
||||
{
|
||||
if(response.data[i] == '\n' &&
|
||||
response.data[i-1] == '\r' &&
|
||||
response.data[i-2] == '\n' &&
|
||||
response.data[i-3] == '\r')
|
||||
{
|
||||
filestart = response.data + i + 1;
|
||||
filesize = response.size - i - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(response.size == 0 || response.data == NULL) return emptyblock;
|
||||
|
||||
// Check for the headers
|
||||
char httpCode[3];
|
||||
memcpy(httpCode, &response.data[9], 3);
|
||||
int retCode = atoi(httpCode);
|
||||
|
||||
switch(retCode)
|
||||
{
|
||||
case 301:
|
||||
case 302:
|
||||
case 307: // Moved
|
||||
/*
|
||||
{
|
||||
char redirectedTo[255];
|
||||
if(findHeader((char *) response.data, (filestart - response.data), "Location", redirectedTo, 255) == 0) {
|
||||
return downloadfile(buffer, bufferSize, (char *) redirectedTo, f, ud);
|
||||
}
|
||||
return emptyblock;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case 404: // Error, file not found!
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
if(filestart == NULL) return emptyblock;
|
||||
|
||||
//Copy the file part of the response into a new memoryblock to return
|
||||
struct block file;
|
||||
file.data = filestart;
|
||||
file.size = filesize;
|
||||
return file;
|
||||
}
|
||||
|
113
source/sicksaxis-wrapper/sicksaxis-wrapper.c
Normal file
113
source/sicksaxis-wrapper/sicksaxis-wrapper.c
Normal file
@ -0,0 +1,113 @@
|
||||
|
||||
// A simple wrapper for libsicksaxis, to make it resemble WPAD/PAD more closely.
|
||||
// Written by daxtsu/thedax. I'm releasing this code into the public domain, so do whatever you want with it.
|
||||
|
||||
#include <sicksaxis.h>
|
||||
#include "sicksaxis-wrapper.h"
|
||||
|
||||
static DS3 first;
|
||||
static bool psPressed = false;
|
||||
|
||||
bool DS3_Init()
|
||||
{
|
||||
USB_Initialize();
|
||||
|
||||
if (ss_init() < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ss_initialize(&first);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DS3_Rumble()
|
||||
{
|
||||
if (first.connected && psPressed)
|
||||
{
|
||||
ss_set_rumble(&first, 2, 255, 2, 255);
|
||||
}
|
||||
}
|
||||
|
||||
void DS3_Cleanup()
|
||||
{
|
||||
psPressed = false;
|
||||
ss_close(&first);
|
||||
USB_Deinitialize();
|
||||
}
|
||||
|
||||
unsigned int DS3_ButtonsDown()
|
||||
{
|
||||
if (!ss_is_connected(&first) || !psPressed)
|
||||
return 0;
|
||||
|
||||
DS3 *controller;
|
||||
controller = &first;
|
||||
|
||||
unsigned int pressed = 0;
|
||||
|
||||
pressed |= controller->pad.buttons.PS ? DS3_BUTTON_PS : 0;
|
||||
pressed |= controller->pad.buttons.start ? DS3_BUTTON_START : 0;
|
||||
pressed |= controller->pad.buttons.select ? DS3_BUTTON_SELECT : 0;
|
||||
pressed |= controller->pad.buttons.triangle ? DS3_BUTTON_TRIANGLE : 0;
|
||||
pressed |= controller->pad.buttons.circle ? DS3_BUTTON_CIRCLE : 0;
|
||||
pressed |= controller->pad.buttons.cross ? DS3_BUTTON_CROSS : 0;
|
||||
pressed |= controller->pad.buttons.square ? DS3_BUTTON_SQUARE : 0;
|
||||
pressed |= controller->pad.buttons.up ? DS3_BUTTON_UP : 0;
|
||||
pressed |= controller->pad.buttons.right ? DS3_BUTTON_RIGHT : 0;
|
||||
pressed |= controller->pad.buttons.down ? DS3_BUTTON_DOWN : 0;
|
||||
pressed |= controller->pad.buttons.left ? DS3_BUTTON_LEFT : 0;
|
||||
pressed |= controller->pad.buttons.L1 ? DS3_BUTTON_L1 : 0;
|
||||
pressed |= controller->pad.buttons.L2 ? DS3_BUTTON_L2 : 0;
|
||||
pressed |= controller->pad.buttons.L3 ? DS3_BUTTON_L3 : 0;
|
||||
pressed |= controller->pad.buttons.R1 ? DS3_BUTTON_R1 : 0;
|
||||
pressed |= controller->pad.buttons.R2 ? DS3_BUTTON_R2 : 0;
|
||||
pressed |= controller->pad.buttons.R3 ? DS3_BUTTON_R3 : 0;
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
bool DS3_Connected()
|
||||
{
|
||||
return first.connected > 0 && psPressed;
|
||||
}
|
||||
|
||||
void DS3_ScanPads()
|
||||
{
|
||||
if (!ss_is_connected(&first))
|
||||
{
|
||||
psPressed = false;
|
||||
ss_initialize(&first);
|
||||
if (ss_open(&first) > 0)
|
||||
{
|
||||
ss_start_reading(&first);
|
||||
ss_set_led(&first, 0);
|
||||
}
|
||||
}
|
||||
else if (first.pad.buttons.PS && !psPressed)
|
||||
{
|
||||
psPressed = true;
|
||||
ss_set_led(&first, 1);
|
||||
}
|
||||
}
|
||||
|
||||
int DS3_StickX()
|
||||
{
|
||||
return psPressed? first.pad.left_analog.x - 128 : 0;
|
||||
}
|
||||
|
||||
int DS3_SubStickX()
|
||||
{
|
||||
return psPressed? first.pad.right_analog.x - 128 : 0;
|
||||
}
|
||||
|
||||
int DS3_StickY()
|
||||
{
|
||||
return psPressed? first.pad.left_analog.y - 128 : 0;
|
||||
}
|
||||
|
||||
int DS3_SubStickY()
|
||||
{
|
||||
return psPressed? first.pad.right_analog.y - 128 : 0;
|
||||
}
|
51
source/sicksaxis-wrapper/sicksaxis-wrapper.h
Normal file
51
source/sicksaxis-wrapper/sicksaxis-wrapper.h
Normal file
@ -0,0 +1,51 @@
|
||||
// A simple wrapper for libsicksaxis, to make it resemble WPAD/PAD more closely.
|
||||
// Written by daxtsu/thedax. I'm releasing this code into the public domain, so do whatever you want with it.
|
||||
|
||||
#ifndef _DS3WRAPPER_H_
|
||||
#define _DS3WRAPPER_H_
|
||||
|
||||
#include <gctypes.h>
|
||||
|
||||
struct ss_device;
|
||||
|
||||
enum
|
||||
{
|
||||
DS3_BUTTON_PS = 1,
|
||||
DS3_BUTTON_START = 2,
|
||||
DS3_BUTTON_SELECT = 4,
|
||||
DS3_BUTTON_TRIANGLE = 8,
|
||||
DS3_BUTTON_CIRCLE = 16,
|
||||
DS3_BUTTON_CROSS = 32,
|
||||
DS3_BUTTON_SQUARE = 64,
|
||||
DS3_BUTTON_UP = 128,
|
||||
DS3_BUTTON_RIGHT = 256,
|
||||
DS3_BUTTON_DOWN = 512,
|
||||
DS3_BUTTON_LEFT = 1024,
|
||||
DS3_BUTTON_L1 = 2048,
|
||||
DS3_BUTTON_L2 = 4096,
|
||||
DS3_BUTTON_L3 = 8192,
|
||||
DS3_BUTTON_R1 = 16384,
|
||||
DS3_BUTTON_R2 = 32768,
|
||||
DS3_BUTTON_R3 = 65536,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct ss_device DS3;
|
||||
bool DS3_Init();
|
||||
void DS3_Rumble();
|
||||
void DS3_Cleanup();
|
||||
u32 DS3_ButtonsDown();
|
||||
void DS3_ScanPads();
|
||||
int DS3_StickX();
|
||||
int DS3_SubStickX();
|
||||
int DS3_StickY();
|
||||
int DS3_SubStickY();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user