Skip to content

Commit

Permalink
★ Load webMAN MOD Addon
Browse files Browse the repository at this point in the history
- New addon that lets load webMAN MOD plugin from XMB
- Holding down the SQUARE button creates boot_plugins.txt and restarts the PS3
- Find more information in README.md
  • Loading branch information
aldostools committed May 25, 2024
1 parent 2a69e11 commit 2382046
Show file tree
Hide file tree
Showing 10 changed files with 356 additions and 0 deletions.
8 changes: 8 additions & 0 deletions _Projects_/load_wmm/Make_Clean.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@echo off
set PS3SDK=/c/PSDK3v2
set WIN_PS3SDK=C:/PSDK3v2
set PATH=%WIN_PS3SDK%/mingw/msys/1.0/bin;%WIN_PS3SDK%/mingw/bin;%WIN_PS3SDK%/ps3dev/bin;%WIN_PS3SDK%/ps3dev/ppu/bin;%WIN_PS3SDK%/ps3dev/spu/bin;%WIN_PS3SDK%/mingw/Python27;%PATH%;
set PSL1GHT=%PS3SDK%/psl1ght
set PS3DEV=%PS3SDK%/ps3dev

make clean
22 changes: 22 additions & 0 deletions _Projects_/load_wmm/Make_PKG.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@echo off
set PS3SDK=/c/PSDK3v2
set WIN_PS3SDK=C:/PSDK3v2
set PATH=%WIN_PS3SDK%/mingw/msys/1.0/bin;%WIN_PS3SDK%/mingw/bin;%WIN_PS3SDK%/ps3dev/bin;%WIN_PS3SDK%/ps3dev/ppu/bin;%WIN_PS3SDK%/ps3dev/spu/bin;%WIN_PS3SDK%/mingw/Python27;%PATH%;
set PSL1GHT=%PS3SDK%/psl1ght
set PS3DEV=%PS3SDK%/ps3dev

if exist EP0001-LOADWMMOD_00-0000000000000000.pkg del EP0001-LOADWMMOD_00-0000000000000000.pkg>>nul

if exist load_wmm.elf del load_wmm.elf>>nul
if exist load_wmm.self del load_wmm.self>>nul
if exist build del /s/q build\*.*>>nul

make pkg

del load_wmm.elf>>nul
del load_wmm.self>>nul
del /s/q build\*.*>>nul
rd /q/s build>>nul

:end
pause
189 changes: 189 additions & 0 deletions _Projects_/load_wmm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(PSL1GHT)),)
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
endif

include $(PSL1GHT)/ppu_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 := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
PKGFILES := $(CURDIR)/pkgfiles

TITLE := Load webMAN MOD
APPID := LOADWMMOD
CONTENTID := EP0001-$(APPID)_00-0000000000000000

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------

# aditional scetool flags (--self-ctrl-flags, --self-cap-flags...)
SCETOOL_FLAGS += -2 0A
SCETOOL_FLAGS += --self-ctrl-flags 4000000000000000000000000000000000000000000000000000000000000002
SCETOOL_FLAGS += --self-cap-flags 00000000000000000000000000000000000000000000007B0000000100000000

CFLAGS = -O2 -Wall -mcpu=cell $(MACHDEP) $(INCLUDE)
CXXFLAGS = $(CFLAGS)

LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lio -lsysutil -lm

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(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 OUTPUT := $(CURDIR)/$(TARGET)

export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR := $(CURDIR)/$(BUILD)

export BUILDDIR := $(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin)))
PNGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.png)))
JPGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.jpg)))
TTFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ttf)))
VCGFILES := $(foreach dir,$(SHADERS),$(notdir $(wildcard $(dir)/*.vcg)))
FCGFILES := $(foreach dir,$(SHADERS),$(notdir $(wildcard $(dir)/*.fcg)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
export LD := $(CC)
else
export LD := $(CXX)
endif

export OFILES := $(addsuffix .o,$(BINFILES)) \
$(addsuffix .o,$(TTFFILES)) \
$(addsuffix .o,$(VPOFILES)) \
$(addsuffix .o,$(FPOFILES)) \
$(addsuffix .o,$(PNGFILES)) \
$(addsuffix .o,$(JPGFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o)

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE := -I$(PORTLIBS)/include/freetype2 \
$(foreach dir,$(INCLUDES), -I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(LIBPSL1GHT_INC) \
-I$(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
$(LIBPSL1GHT_LIB)

export OUTPUT := $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) *.elf *.self *.pkg

#---------------------------------------------------------------------------------
run:
ps3load $(OUTPUT).self

#---------------------------------------------------------------------------------
pkg: $(BUILD) $(OUTPUT).pkg

#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).self: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .bin extension
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

#---------------------------------------------------------------------------------
%.ttf.o : %.ttf
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

#---------------------------------------------------------------------------------
%.vpo.o : %.vpo
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

#---------------------------------------------------------------------------------
%.fpo.o : %.fpo
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

#---------------------------------------------------------------------------------
%.jpg.o : %.jpg
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.png.o : %.png
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
31 changes: 31 additions & 0 deletions _Projects_/load_wmm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Load webMAN MOD

This is a simple addon used to load webMAN MOD from its default path.

## Requisites

Requires webMAN MOD installed in the PS3 system.

If `/dev_hdd0/plugins/webftp_server.sprx` is not found it will beep 3 times.

Cobra/MAMBA/PS3HEN payload must be enabled and loaded.

By default the plugin will load in VSH slot 1.

If webMAN MOD did not load after return to XMB, run the addon again with the button combos.

## Combos

If you press and hold these buttons:
L1 = Load webMAN MOD plugin in slot 2
L2 = Load webMAN MOD plugin in slot 3
R1 = Load webMAN MOD plugin in slot 4
R2 = Load webMAN MOD plugin in slot 5

SQUARE = Create /dev_hdd0/boot_plugins.txt and reboots (if the plugin exists)

## Use Cases
- Load webMAN MOD on demand.
- Load webMAN MOD if boot_plugins.txt was removed or edited to don't load the plugin.
- Reload webMAN MOD after unload it.
- Re-Create /dev_hdd0/boot_plugins.txt if the file was deleted or damaged.
Binary file added _Projects_/load_wmm/pkgfiles/ICON0.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _Projects_/load_wmm/pkgfiles/PARAM.SFO
Binary file not shown.
105 changes: 105 additions & 0 deletions _Projects_/load_wmm/source/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#include <ppu-lv2.h>
#include <sys/file.h>
#include <stdio.h>
#include <string.h>
#include <io/pad.h>

#define BUTTON_SQUARE 0x80
#define BUTTON_CROSS 0x40
#define BUTTON_CIRCLE 0x20
#define BUTTON_TRIANGLE 0x10
#define BUTTON_R1 0x08
#define BUTTON_L1 0x04
#define BUTTON_R2 0x02
#define BUTTON_L2 0x01

#define SC_SYS_POWER (379)
#define SYS_REBOOT 0x8201

#define SC_RING_BUZZER (392)

#define BEEP1 { lv2syscall3(SC_RING_BUZZER, 0x1004, 0x4, 0x6); }
#define BEEP2 { lv2syscall3(SC_RING_BUZZER, 0x1004, 0x7, 0x36); }
#define BEEP3 { lv2syscall3(SC_RING_BUZZER, 0x1004, 0xa, 0x1b6); }

#define SYSCALL8_OPCODE_UNLOAD_VSH_PLUGIN 0x364F
#define SYSCALL8_OPCODE_LOAD_VSH_PLUGIN 0x1EE7

#define SUCCESS 0
#define FAILED -1

#define PLUGIN_PATH "/dev_hdd0/plugins/webftp_server.sprx"
#define PLUGIN_LINE PLUGIN_PATH "\n"

static int cobra_unload_vsh_plugin(unsigned int slot)
{
lv2syscall2(8, SYSCALL8_OPCODE_UNLOAD_VSH_PLUGIN, (u64)slot);
return_to_user_prog(int);
}

static int cobra_load_vsh_plugin(unsigned int slot, const char *path, void *arg, u32 arg_size)
{
lv2syscall5(8, SYSCALL8_OPCODE_LOAD_VSH_PLUGIN, slot, (u64)path, (u64)arg, arg_size);
return_to_user_prog(int);
}

static bool file_exists(const char *path)
{
sysFSStat stat;
return (sysLv2FsStat(path, &stat) == SUCCESS);
}

int main()
{
unsigned int slot = 1;
unsigned int button = 0;

padInfo padinfo;
padData paddata;

ioPadInit(7);

int n, r;
for(r = 0; r < 10; r++)
{
ioPadGetInfo(&padinfo);
for(n = 0; n < 7; n++)
{
if(padinfo.status[n])
{
ioPadGetData(n, &paddata);
button = (paddata.button[2] << 8) | (paddata.button[3] & 0xff);
break;
}
}
if(button) break; else usleep(20000);
}
ioPadEnd();

if(button & (BUTTON_L1)) slot = 2;
if(button & (BUTTON_L2)) slot = 3;
if(button & (BUTTON_R1)) slot = 4;
if(button & (BUTTON_R2)) slot = 5;
if(button & (BUTTON_CROSS)) slot = 6;

cobra_unload_vsh_plugin(slot);
sleep(1);
if(file_exists(PLUGIN_PATH))
{
if(button & (BUTTON_SQUARE))
{
FILE* f = fopen("/dev_hdd0/boot_plugins.txt", "w");
if(f != NULL)
{
fwrite((const char*)PLUGIN_LINE, 1, sizeof(PLUGIN_LINE) - 1, f);
fclose(f);
}
{lv2syscall3(SC_SYS_POWER, SYS_REBOOT, 0, 0); return_to_user_prog(int);}
}
cobra_load_vsh_plugin(slot, PLUGIN_PATH, NULL, 0);
}
else
BEEP3;

return 0;
}
Binary file not shown.
1 change: 1 addition & 0 deletions _Projects_/updater/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ int main()

// webMAN ADD-ONS
file_copy(APP_USRDIR "/addons/prepISO.pkg", RES_DIR "/prepISO.pkg");
file_copy(APP_USRDIR "/addons/load_wmm.pkg", RES_DIR "/load_wmm.pkg");
file_copy(APP_USRDIR "/addons/ps3mon.sprx", RES_DIR "/ps3mon.sprx");
file_copy(APP_USRDIR "/addons/RELOAD_XMB.ISO", RES_DIR "/RELOAD_XMB.ISO");
file_copy(APP_USRDIR "/addons/boot_mamba.pkg", RES_DIR "/boot_mamba.pkg");
Expand Down
Binary file not shown.

0 comments on commit 2382046

Please sign in to comment.