Coding Questions and other Quandaries
Here is the Make file supplied with the tutorial:

#---------------------------------------------------------------------------------
# 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 := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include

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

CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) #####Vega, Is this what your talking about?####
CXXFLAGS = $(CFLAGS) ####### I don't see any reference to optimization

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

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lwiiuse -lbte -logc -lm

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS :=

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT := $(CURDIR)/$(TARGET)

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

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

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

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

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

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

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

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

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

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol

#---------------------------------------------------------------------------------
run:
psoload $(TARGET).dol

#---------------------------------------------------------------------------------
reload:
psoload -r $(TARGET).dol


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

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

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

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

-include $(DEPENDS)

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

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

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
Reply
Code:
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)

Change the "-O2" to "-Os"
Reply
Well here's a teachable moment. Hopefully you can walk me through calling the following function.

In the symbol map I found a function: AddDebugWeapons

At no time during bootup or gameplay is this function called (Using BP on 0x80041768)

80041768 AddDebugWeapons__5CGameFv stwu sp, -0x0040 (sp)
8004176c AddDebugWeapons__5CGameFv mflr r0
80041770 AddDebugWeapons__5CGameFv stw r0, 0x0044 (sp)
80041774 AddDebugWeapons__5CGameFv stw r31, 0x003C (sp)
80041778 AddDebugWeapons__5CGameFv mr r31, r3
8004177c AddDebugWeapons__5CGameFv stw r30, 0x0038 (sp)
80041780 AddDebugWeapons__5CGameFv stw r29, 0x0034 (sp)
80041784 AddDebugWeapons__5CGameFv stw r28, 0x0030 (sp)
80041788 AddDebugWeapons__5CGameFv lwz r4, 0x03A0 (r3)
8004178c AddDebugWeapons__5CGameFv lwz r4, 0x17DC (r4)
80041790 AddDebugWeapons__5CGameFv lwz r28, 0x0004 (r4)
80041794 AddDebugWeapons__5CGameFv cmpwi r28, 0
80041798 AddDebugWeapons__5CGameFv beq- ->0x800419A0
8004179c AddDebugWeapons__5CGameFv lwz r0, -0x5B58 (r13)
800417a0 AddDebugWeapons__5CGameFv cmpwi r0, 0
800417a4 AddDebugWeapons__5CGameFv beq- ->0x8004193C
800417a8 AddDebugWeapons__5CGameFv lis r5, 0x4352
800417ac AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
800417b0 AddDebugWeapons__5CGameFv addi r5, r5, 20307
800417b4 AddDebugWeapons__5CGameFv li r6, 1
800417b8 AddDebugWeapons__5CGameFv li r7, 1
800417bc AddDebugWeapons__5CGameFv bl ->0x800419C0
800417c0 AddDebugWeapons__5CGameFv lis r5, 0x434C
800417c4 AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
800417c8 AddDebugWeapons__5CGameFv mr r3, r31
800417cc AddDebugWeapons__5CGameFv li r6, 1
800417d0 AddDebugWeapons__5CGameFv addi r5, r5, 21826
800417d4 AddDebugWeapons__5CGameFv li r7, 1
800417d8 AddDebugWeapons__5CGameFv bl ->0x800419C0
800417dc AddDebugWeapons__5CGameFv lis r5, 0x4245
800417e0 AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
800417e4 AddDebugWeapons__5CGameFv mr r3, r31
800417e8 AddDebugWeapons__5CGameFv li r6, 1
800417ec AddDebugWeapons__5CGameFv addi r5, r5, 16724
800417f0 AddDebugWeapons__5CGameFv li r7, 1
800417f4 AddDebugWeapons__5CGameFv bl ->0x800419C0
800417f8 AddDebugWeapons__5CGameFv lis r29, 0x5542
800417fc AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
80041800 AddDebugWeapons__5CGameFv mr r3, r31
80041804 AddDebugWeapons__5CGameFv li r6, 1
80041808 AddDebugWeapons__5CGameFv addi r5, r29, 17748
8004180c AddDebugWeapons__5CGameFv li r7, 1
80041810 AddDebugWeapons__5CGameFv bl ->0x800419C0
80041814 AddDebugWeapons__5CGameFv lis r5, 0x4353
80041818 AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
8004181c AddDebugWeapons__5CGameFv mr r3, r31
80041820 AddDebugWeapons__5CGameFv li r6, 1
80041824 AddDebugWeapons__5CGameFv addi r5, r5, 16727
80041828 AddDebugWeapons__5CGameFv li r7, 1
8004182c AddDebugWeapons__5CGameFv bl ->0x800419C0
80041830 AddDebugWeapons__5CGameFv lis r5, 0x5348
80041834 AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
80041838 AddDebugWeapons__5CGameFv mr r3, r31
8004183c AddDebugWeapons__5CGameFv li r6, 1
80041840 AddDebugWeapons__5CGameFv addi r5, r5, 20308
80041844 AddDebugWeapons__5CGameFv li r7, 1
80041848 AddDebugWeapons__5CGameFv bl ->0x800419C0
8004184c AddDebugWeapons__5CGameFv lis r5, 0x4342
80041850 AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
80041854 AddDebugWeapons__5CGameFv mr r3, r31
80041858 AddDebugWeapons__5CGameFv li r6, 1
8004185c AddDebugWeapons__5CGameFv addi r5, r5, 20311
80041860 AddDebugWeapons__5CGameFv li r7, 1
80041864 AddDebugWeapons__5CGameFv bl ->0x800419C0
80041868 AddDebugWeapons__5CGameFv lis r5, 0x5441
8004186c AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
80041870 AddDebugWeapons__5CGameFv mr r3, r31
80041874 AddDebugWeapons__5CGameFv li r6, 1
80041878 AddDebugWeapons__5CGameFv addi r5, r5, 21317
8004187c AddDebugWeapons__5CGameFv li r7, 1
80041880 AddDebugWeapons__5CGameFv bl ->0x800419C0
80041884 AddDebugWeapons__5CGameFv lis r5, 0x4755
80041888 AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
8004188c AddDebugWeapons__5CGameFv mr r3, r31
80041890 AddDebugWeapons__5CGameFv li r6, 1
80041894 AddDebugWeapons__5CGameFv addi r5, r5, 19968
80041898 AddDebugWeapons__5CGameFv li r7, 1
8004189c AddDebugWeapons__5CGameFv bl ->0x800419C0
800418a0 AddDebugWeapons__5CGameFv lis r5, 0x4459
800418a4 AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
800418a8 AddDebugWeapons__5CGameFv mr r3, r31
800418ac AddDebugWeapons__5CGameFv li r6, 1
800418b0 AddDebugWeapons__5CGameFv addi r5, r5, 20033
800418b4 AddDebugWeapons__5CGameFv li r7, 5
800418b8 AddDebugWeapons__5CGameFv bl ->0x800419C0
800418bc AddDebugWeapons__5CGameFv lis r30, 0x464C
800418c0 AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
800418c4 AddDebugWeapons__5CGameFv mr r3, r31
800418c8 AddDebugWeapons__5CGameFv li r6, 1
800418cc AddDebugWeapons__5CGameFv addi r5, r30, 16967
800418d0 AddDebugWeapons__5CGameFv li r7, 5
800418d4 AddDebugWeapons__5CGameFv bl ->0x800419C0
800418d8 AddDebugWeapons__5CGameFv lis r5, 0x555A
800418dc AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
800418e0 AddDebugWeapons__5CGameFv mr r3, r31
800418e4 AddDebugWeapons__5CGameFv li r6, 1
800418e8 AddDebugWeapons__5CGameFv addi r5, r5, 18688
800418ec AddDebugWeapons__5CGameFv li r7, 1
800418f0 AddDebugWeapons__5CGameFv bl ->0x800419C0
800418f4 AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
800418f8 AddDebugWeapons__5CGameFv mr r3, r31
800418fc AddDebugWeapons__5CGameFv addi r5, r29, 17996
80041900 AddDebugWeapons__5CGameFv li r6, 1
80041904 AddDebugWeapons__5CGameFv li r7, 1
80041908 AddDebugWeapons__5CGameFv bl ->0x800419C0
8004190c AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
80041910 AddDebugWeapons__5CGameFv mr r3, r31
80041914 AddDebugWeapons__5CGameFv addi r5, r30, 18261
80041918 AddDebugWeapons__5CGameFv li r6, 1
8004191c AddDebugWeapons__5CGameFv li r7, 1
80041920 AddDebugWeapons__5CGameFv bl ->0x800419C0
80041924 AddDebugWeapons__5CGameFv lwz r4, 0x0010 (r28)
80041928 AddDebugWeapons__5CGameFv mr r3, r31
8004192c AddDebugWeapons__5CGameFv addi r5, r30, 16961
80041930 AddDebugWeapons__5CGameFv li r6, 1
80041934 AddDebugWeapons__5CGameFv li r7, 1
80041938 AddDebugWeapons__5CGameFv bl ->0x800419C0
8004193c AddDebugWeapons__5CGameFv lwz r0, -0x5B50 (r13)
80041940 AddDebugWeapons__5CGameFv cmpwi r0, 0
80041944 AddDebugWeapons__5CGameFv beq- ->0x800419A0
80041948 AddDebugWeapons__5CGameFv addi r3, sp, 8
8004194c AddDebugWeapons__5CGameFv bl ->0x8004D07C
80041950 AddDebugWeapons__5CGameFv lis r3, 0x464C
80041954 AddDebugWeapons__5CGameFv li r5, 1
80041958 AddDebugWeapons__5CGameFv addi r3, r3, 16723
8004195c AddDebugWeapons__5CGameFv li r0, 0
80041960 AddDebugWeapons__5CGameFv stw r5, 0x0008 (sp)
80041964 AddDebugWeapons__5CGameFv addi r4, sp, 8
80041968 AddDebugWeapons__5CGameFv stw r3, 0x000C (sp)
8004196c AddDebugWeapons__5CGameFv stw r5, 0x0010 (sp)
80041970 AddDebugWeapons__5CGameFv stw r5, 0x0024 (sp)
80041974 AddDebugWeapons__5CGameFv stw r0, 0x0020 (sp)
80041978 AddDebugWeapons__5CGameFv stw r5, 0x0014 (sp)
8004197c AddDebugWeapons__5CGameFv lwz r3, 0x03A0 (r31)
80041980 AddDebugWeapons__5CGameFv lwz r3, 0x1824 (r3)
80041984 AddDebugWeapons__5CGameFv bl ->0x8004D928
80041988 AddDebugWeapons__5CGameFv li r0, 2
8004198c AddDebugWeapons__5CGameFv addi r4, sp, 8
80041990 AddDebugWeapons__5CGameFv stw r0, 0x0010 (sp)
80041994 AddDebugWeapons__5CGameFv lwz r3, 0x03A0 (r31)
80041998 AddDebugWeapons__5CGameFv lwz r3, 0x1824 (r3)
8004199c AddDebugWeapons__5CGameFv bl ->0x8004D928
800419a0 AddDebugWeapons__5CGameFv lwz r0, 0x0044 (sp)
800419a4 AddDebugWeapons__5CGameFv lwz r31, 0x003C (sp)
800419a8 AddDebugWeapons__5CGameFv lwz r30, 0x0038 (sp)
800419ac AddDebugWeapons__5CGameFv lwz r29, 0x0034 (sp)
800419b0 AddDebugWeapons__5CGameFv lwz r28, 0x0030 (sp)
800419b4 AddDebugWeapons__5CGameFv mtlr r0
800419b8 AddDebugWeapons__5CGameFv addi sp, sp, 64
800419bc AddDebugWeapons__5CGameFv blr

The next part is branched to from the above.

AddDebugWeapon__5CGameFUiUiUiUi:
800419c0 AddDebugWeapon__5CGameFUiUiUiU stwu sp, -0x0050 (sp)
800419c4 AddDebugWeapon__5CGameFUiUiUiU mflr r0
800419c8 AddDebugWeapon__5CGameFUiUiUiU stw r0, 0x0054 (sp)
800419cc AddDebugWeapon__5CGameFUiUiUiU addi r11, sp, 80
800419d0 AddDebugWeapon__5CGameFUiUiUiU bl ->0x80240330
800419d4 AddDebugWeapon__5CGameFUiUiUiU lwz r8, -0x5B6C (r13)
800419d8 AddDebugWeapon__5CGameFUiUiUiU mr r28, r3
800419dc AddDebugWeapon__5CGameFUiUiUiU mr r30, r5
800419e0 AddDebugWeapon__5CGameFUiUiUiU mr r29, r4
800419e4 AddDebugWeapon__5CGameFUiUiUiU lwz r3, 0x03A0 (r8)
800419e8 AddDebugWeapon__5CGameFUiUiUiU mr r26, r6
800419ec AddDebugWeapon__5CGameFUiUiUiU mr r27, r7
800419f0 AddDebugWeapon__5CGameFUiUiUiU mr r4, r30
800419f4 AddDebugWeapon__5CGameFUiUiUiU lwz r3, 0x17FC (r3)
800419f8 AddDebugWeapon__5CGameFUiUiUiU bl ->0x801865B0
800419fc AddDebugWeapon__5CGameFUiUiUiU cmpwi r3, 0
80041a00 AddDebugWeapon__5CGameFUiUiUiU mr r31, r3
80041a04 AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041A14
80041a08 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x000C (r3)
80041a0c AddDebugWeapon__5CGameFUiUiUiU rlwinm. r0, r0, 0, 31, 31 (00000001)
80041a10 AddDebugWeapon__5CGameFUiUiUiU bne- ->0x80041A3C
80041a14 AddDebugWeapon__5CGameFUiUiUiU cmpwi r3, 0
80041a18 AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041BD0
80041a1c AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041BD0
80041a20 AddDebugWeapon__5CGameFUiUiUiU lwz r12, 0 (r31)
80041a24 AddDebugWeapon__5CGameFUiUiUiU mr r3, r31
80041a28 AddDebugWeapon__5CGameFUiUiUiU li r4, 1
80041a2c AddDebugWeapon__5CGameFUiUiUiU lwz r12, 0x0008 (r12)
80041a30 AddDebugWeapon__5CGameFUiUiUiU mtctr r12
80041a34 AddDebugWeapon__5CGameFUiUiUiU bctrl
80041a38 AddDebugWeapon__5CGameFUiUiUiU b ->0x80041BD0
80041a3c AddDebugWeapon__5CGameFUiUiUiU stw r27, 0x00C8 (r3)
80041a40 AddDebugWeapon__5CGameFUiUiUiU subis r0, r30, 17497
80041a44 AddDebugWeapon__5CGameFUiUiUiU cmplwi r0, 20033
80041a48 AddDebugWeapon__5CGameFUiUiUiU lfs f0, 0x0114 (r3)
80041a4c AddDebugWeapon__5CGameFUiUiUiU stfs f0, 0x0118 (r3)
80041a50 AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041A60
80041a54 AddDebugWeapon__5CGameFUiUiUiU subis r0, r30, 17996
80041a58 AddDebugWeapon__5CGameFUiUiUiU cmplwi r0, 16967
80041a5c AddDebugWeapon__5CGameFUiUiUiU bne- ->0x80041A7C
80041a60 AddDebugWeapon__5CGameFUiUiUiU lis r0, 0x4330
80041a64 AddDebugWeapon__5CGameFUiUiUiU stw r27, 0x002C (sp)
80041a68 AddDebugWeapon__5CGameFUiUiUiU lfd f1, -0x7F78 (rtoc)
80041a6c AddDebugWeapon__5CGameFUiUiUiU stw r0, 0x0028 (sp)
80041a70 AddDebugWeapon__5CGameFUiUiUiU lfd f0, 0x0028 (sp)
80041a74 AddDebugWeapon__5CGameFUiUiUiU fsubs f0,f0,f1
80041a78 AddDebugWeapon__5CGameFUiUiUiU stfs f0, 0x0118 (r3)
80041a7c AddDebugWeapon__5CGameFUiUiUiU addi r3, sp, 8
80041a80 AddDebugWeapon__5CGameFUiUiUiU bl ->0x8004D07C
80041a84 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x000C (r31)
80041a88 AddDebugWeapon__5CGameFUiUiUiU mr r3, r31
80041a8c AddDebugWeapon__5CGameFUiUiUiU stw r0, 0x0008 (sp)
80041a90 AddDebugWeapon__5CGameFUiUiUiU stw r30, 0x000C (sp)
80041a94 AddDebugWeapon__5CGameFUiUiUiU stw r26, 0x0010 (sp)
80041a98 AddDebugWeapon__5CGameFUiUiUiU lwz r12, 0 (r31)
80041a9c AddDebugWeapon__5CGameFUiUiUiU lwz r12, 0x0038 (r12)
80041aa0 AddDebugWeapon__5CGameFUiUiUiU mtctr r12
80041aa4 AddDebugWeapon__5CGameFUiUiUiU bctrl
80041aa8 AddDebugWeapon__5CGameFUiUiUiU stw r3, 0x0024 (sp)
80041aac AddDebugWeapon__5CGameFUiUiUiU mr r3, r31
80041ab0 AddDebugWeapon__5CGameFUiUiUiU lwz r12, 0 (r31)
80041ab4 AddDebugWeapon__5CGameFUiUiUiU lwz r12, 0x0034 (r12)
80041ab8 AddDebugWeapon__5CGameFUiUiUiU mtctr r12
80041abc AddDebugWeapon__5CGameFUiUiUiU bctrl
80041ac0 AddDebugWeapon__5CGameFUiUiUiU stw r3, 0x0020 (sp)
80041ac4 AddDebugWeapon__5CGameFUiUiUiU addi r4, sp, 8
80041ac8 AddDebugWeapon__5CGameFUiUiUiU lfs f0, 0x0118 (r31)
80041acc AddDebugWeapon__5CGameFUiUiUiU stfs f0, 0x0018 (sp)
80041ad0 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x00C8 (r31)
80041ad4 AddDebugWeapon__5CGameFUiUiUiU stw r0, 0x0014 (sp)
80041ad8 AddDebugWeapon__5CGameFUiUiUiU lwz r3, 0x03A0 (r28)
80041adc AddDebugWeapon__5CGameFUiUiUiU lwz r3, 0x1824 (r3)
80041ae0 AddDebugWeapon__5CGameFUiUiUiU bl ->0x8004D928
80041ae4 AddDebugWeapon__5CGameFUiUiUiU cmpwi r31, 0
80041ae8 AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041B08
80041aec AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041B08
80041af0 AddDebugWeapon__5CGameFUiUiUiU lwz r12, 0 (r31)
80041af4 AddDebugWeapon__5CGameFUiUiUiU mr r3, r31
80041af8 AddDebugWeapon__5CGameFUiUiUiU li r4, 1
80041afc AddDebugWeapon__5CGameFUiUiUiU lwz r12, 0x0008 (r12)
80041b00 AddDebugWeapon__5CGameFUiUiUiU mtctr r12
80041b04 AddDebugWeapon__5CGameFUiUiUiU bctrl
80041b08 AddDebugWeapon__5CGameFUiUiUiU lis r4, 0x803F
80041b0c AddDebugWeapon__5CGameFUiUiUiU li r31, -1
80041b10 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x5720 (r4)
80041b14 AddDebugWeapon__5CGameFUiUiUiU cmplw r30, r0
80041b18 AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041B2C
80041b1c AddDebugWeapon__5CGameFUiUiUiU lis r3, 0x803F
80041b20 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x5730 (r3)
80041b24 AddDebugWeapon__5CGameFUiUiUiU cmplw r30, r0
80041b28 AddDebugWeapon__5CGameFUiUiUiU bne- ->0x80041B34
80041b2c AddDebugWeapon__5CGameFUiUiUiU li r31, 0
80041b30 AddDebugWeapon__5CGameFUiUiUiU b ->0x80041B98
80041b34 AddDebugWeapon__5CGameFUiUiUiU addi r4, r4, 22304
80041b38 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x0004 (r4)
80041b3c AddDebugWeapon__5CGameFUiUiUiU cmplw r30, r0
80041b40 AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041B54
80041b44 AddDebugWeapon__5CGameFUiUiUiU addi r3, r3, 22320
80041b48 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x0004 (r3)
80041b4c AddDebugWeapon__5CGameFUiUiUiU cmplw r30, r0
80041b50 AddDebugWeapon__5CGameFUiUiUiU bne- ->0x80041B5C
80041b54 AddDebugWeapon__5CGameFUiUiUiU li r31, 1
80041b58 AddDebugWeapon__5CGameFUiUiUiU b ->0x80041B98
80041b5c AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x0008 (r4)
80041b60 AddDebugWeapon__5CGameFUiUiUiU cmplw r30, r0
80041b64 AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041B74
80041b68 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x0008 (r3)
80041b6c AddDebugWeapon__5CGameFUiUiUiU cmplw r30, r0
80041b70 AddDebugWeapon__5CGameFUiUiUiU bne- ->0x80041B7C
80041b74 AddDebugWeapon__5CGameFUiUiUiU li r31, 2
80041b78 AddDebugWeapon__5CGameFUiUiUiU b ->0x80041B98
80041b7c AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x000C (r4)
80041b80 AddDebugWeapon__5CGameFUiUiUiU cmplw r30, r0
80041b84 AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041B94
80041b88 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x000C (r3)
80041b8c AddDebugWeapon__5CGameFUiUiUiU cmplw r30, r0
80041b90 AddDebugWeapon__5CGameFUiUiUiU bne- ->0x80041B98
80041b94 AddDebugWeapon__5CGameFUiUiUiU li r31, 3
80041b98 AddDebugWeapon__5CGameFUiUiUiU cmpwi r31, -1
80041b9c AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041BD0
80041ba0 AddDebugWeapon__5CGameFUiUiUiU lwz r3, 0x0380 (r28)
80041ba4 AddDebugWeapon__5CGameFUiUiUiU mr r4, r29
80041ba8 AddDebugWeapon__5CGameFUiUiUiU bl ->0x8005D864
80041bac AddDebugWeapon__5CGameFUiUiUiU cmpwi r3, 0
80041bb0 AddDebugWeapon__5CGameFUiUiUiU beq- ->0x80041BD0
80041bb4 AddDebugWeapon__5CGameFUiUiUiU rlwinm r0, r31, 2, 0, 29 (3fffffff)
80041bb8 AddDebugWeapon__5CGameFUiUiUiU add r4, r3, r0
80041bbc AddDebugWeapon__5CGameFUiUiUiU stw r30, 0x0014 (r4)
80041bc0 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x0024 (r3)
80041bc4 AddDebugWeapon__5CGameFUiUiUiU cmpwi r0, 0
80041bc8 AddDebugWeapon__5CGameFUiUiUiU bge- ->0x80041BD0
80041bcc AddDebugWeapon__5CGameFUiUiUiU stw r31, 0x0024 (r3)
80041bd0 AddDebugWeapon__5CGameFUiUiUiU addi r11, sp, 80
80041bd4 AddDebugWeapon__5CGameFUiUiUiU bl ->0x8024037C
80041bd8 AddDebugWeapon__5CGameFUiUiUiU lwz r0, 0x0054 (sp)
80041bdc AddDebugWeapon__5CGameFUiUiUiU mtlr r0
80041be0 AddDebugWeapon__5CGameFUiUiUiU addi sp, sp, 80
80041be4 AddDebugWeapon__5CGameFUiUiUiU blr





Here is a little blurb of the function that has the only branch that will take me to AddDebugWeapons.

There is no conditional/non-conditional branches in the map that takes me to: 8003f2c8 ChangeState__5CGameFv cmpwi r3, 0
At no point, does a BP set on 0x8003f2c8 trip during bootup/gameplay.
The change state function takes place when entering or changing areas.

8003f2a4 ChangeState__5CGameFv addi r4, r4, 21581
8003f2a8 ChangeState__5CGameFv li r0, 0
8003f2ac ChangeState__5CGameFv stw r5, 0x0004 (r3)
8003f2b0 ChangeState__5CGameFv stw r4, 0x000C (r3)
8003f2b4 ChangeState__5CGameFv stw r0, 0x0008 (r3)
8003f2b8 ChangeState__5CGameFv lwz r4, 0x038C (r31)
8003f2bc ChangeState__5CGameFv mr r3, r31
8003f2c0 ChangeState__5CGameFv li r5, 0
8003f2c4 ChangeState__5CGameFv bl ->0x8003FAB4
8003f2c8 ChangeState__5CGameFv cmpwi r3, 0
8003f2cc ChangeState__5CGameFv beq- ->0x8003FA84
8003f2d0 ChangeState__5CGameFv mr r3, r31
8003f2d4 ChangeState__5CGameFv bl ->0x80041768


So how would you go about calling the function?

I used this:

lis r12, 0x8004
addi r12, r12, 0x1768
mtlr r12
blr (and also blrl)

I tried this: momentarily turning it on/off with a C0 code, but the game just crashes.

Does this need to be an inline assembly (C2) code? Hooked to something like a change in the options menu etc...

Here's the button activator for the game: 28444d00 0000XXXX

Thanks!!!!!!
Reply
I'll try to keep this as concise and to the point as possible.

1. Instead of posting entire functions, its better to post their names with their args and return values.

2. Some functions depend on a return value from a previous function. Let's say we have three Functions. A, B, and C. You call A with an initial argument to ask it perform a certain task. If the task completes successfully, function A returns a value that you need to use as an argument for function B. You Call B with that value. Function B then returns you a new value. That new value is needed for Function C. You then call Function C with value. This can get pretty complicated especially if Functions have their own child/sub functions that need their own values that must be derived beforehand.

3. When to call a Function in within a code? Use C2 or C0? This depends greatly. Like in MKWii, some functions are only meant to be called during a Race. Thus a C2 code using a hook address that only occurs during a race would suffice. Trying to write a Code to call it outside a race will end up in an Exception ofc.

4. If you are able to call a Function in C0 (usually it's a generic function like a file handling thing), you may need to disable interrupts.

5. blr/bctr is to have the function NOT return back. This is usually only suitable for functions like Shutting Down the Console. Other functions need to be called with blrl/bctrl. The return address will get saved in the Link Register. Function can return back.

6. Have a better understanding of C/C++ to understand how the game operates on a higher level. This will also give you a better understanding of how functions work on a lower level (Assembly)

7. Conclusion: Read the following two threads completely. If you have already read them, read them again. Another idea is to search on this forum for Codes that include Function Calls. Read over their source(s), that can give you some pointers/tips

https://mariokartwii.com/showthread.php?tid=1052
https://mariokartwii.com/showthread.php?tid=1156
Reply
Manhunt 2 - Wii (E) Walk Through Walls (Press and hold +)


0411b0fc 40820028 #ASM Default code so you only WTW's when you
2853ee8a 00000010 #ASM Press and hold the + button
0411b0fc 60000000 #ASM When held, it NOPs out the original branch instruction
e0000000 00000000 #ASM Halfway terminator
2853ee8a 00002010 #ASM Press and hold the Z and + button (needed for running)
0411b0fc 60000000 #ASM When held, it NOPs out the original branch instruction
e0000000 80008000 #ASM Full terminator

From the symbol map:

8011b0f8 Test__12CCharColDataFP7CEntity fcmpu cr0,f2,f1

8011b0fc Test__12CCharColDataFP7CEntity bne- ->0x8011B124

8011b100 Test__12CCharColDataFP7CEntity lwz r0, -0x3C38 (r13)
8011b104 Test__12CCharColDataFP7CEntity stw r0, 0x0090 (r22)
8011b108 Test__12CCharColDataFP7CEntity mr r3, r21
8011b10c Test__12CCharColDataFP7CEntity bl ->0x8011B8B4
Reply
Manhunt 2 Wii (U) View In game Stats Rev. 1

Appears the game IS keeping track of stats for Style Points in the Wii version.

Dpad L - Kills/Style Points
Dpad U - Executions/Envoromental
Dpad R - Melee/Hides
C + Dpad L - Spotted/Time (ms)
C + Dpad U - Max Style/Style Points

0050f18b 00000001 #ASM This forces branch to the DrawMemUsage function. Got this at TCRF
041b46f0 38a00002 #ASM One of the arguments for the SetFontColour function. Made easier to read. Default 0x38a00001 [li r5, 0x1]
2853e80a 00000001 #ASM Button activator D-pad L
0444fff8 4b696c6c #ASM ASCII string Stat Label "Kills Ttl." Replaces "Mem. Usage"
0444fffc 73205474
02450000 00006c20
04450008 5374796c #ASM ASCII string Stat Label "Style Pts." Replaces "Mem2 Usage"
0445000c 65205074
02450010 0000732e

c21b470c 00000002
3ca08056 60a5f000
80a50638 00000000
###ASM insert 0x801b470c lwz r5, 0x30a8 (r5). Normally loads Mem 1 usage.
lis r5, 0x8056 #Load Upper half word of desired stat address
ori r5, r5, 0xF000 #Load lower half word
lwz r5, 1592(r5) #Load it up for display. in this case, its the number of Kills.

c21b4754 00000002
3ca08056 60a5f000
80a506a8 00000000
e0000000 00000000
###ASM insert 0x801b4754 lwz r5, 0x30a8 (r5). Normally loads Mem2 usage.
lis r5, 0x8056 #Load Upper half word of desired stat address.
ori r5, r5, 0xF000 #Load lower half word
lwz r5, 1592(r5) #Load it up for display. In this case, its Style Points
#####This is repeated for the rest of the stats so for brevity sake, lather, rinse, repeat...

2853e80a 00000008 #ASM Button activator D-pad U
0444fff8 45786563 #ASM ASCII string Stat Label "Execute" Replaces "Mem. Usage"
0444fffc 75746564
02450000 00002020
04450008 456e7669 #ASM ASCII string Stat Label "Enviroment" Replaces "Mem2 Usage"
0445000c 726f6d65
02450010 00006e74
c21b470c 00000002
3ca08056 60a5f000
80a50600 00000000
c21b4754 00000002
3ca08056 60a5f000
80a5061c 00000000
e0000000 00000000
2853e80a 00000002 #ASM Button activator D-pad R
0444fff8 4d656c65
0444fffc 65205474
02450000 00006c20
04450008 48696465
0445000c 73205474
02450010 00006c20
c21b470c 00000002
3ca08056 60a5f000
80a50654 00000000
c21b4754 00000002
3ca08056 60a5f000
80a50670 00000000
e0000000 00000000
2853e80a 00004001 #ASM Button activator C + D-pad L
0444fff8 53706f74
0444fffc 74656420
02450000 00002020
04450008 54696d65
0445000c 20286d73
02450010 00002920
c21b470c 00000002
3ca08056 60a5f000
80a5068c 00000000
c21b4754 00000002
3ca08064 80a51970
60000000 00000000
e0000000 00000000
2853e80a 00004008 #ASM Button activator C + D-pad U
0444fff8 4d617820
0444fffc 5374796c
02450000 00006520
04450008 5374796c
0445000c 65205074
02450010 0000732e
c21b470c 00000002
3ca08056 60a5f000
80a506b0 00000000
c21b4754 00000002
3ca08056 60a5f000
80a506a8 00000000
e0000000 80008000

Anyways, you should get the idea of what I'm doing. Lots of repetition.

Any ideas on how to shorten this thing? 64 lines as it is.
Reply
(02-11-2023, 08:28 PM)Hackwiz Wrote: Any ideas on how to shorten this thing? 64 lines as it is.

For starters, get rid of the 16-bit and 32-bit RAM Write usage for the ASCII String writes. Use the 06 Gecko Codetype (meant for dedicated String Writes) instead.
Reply
Mario Sports Mix (U) RMKE01

Custom Character Selection Modding (See Note)

c36035b0 00000004
3d608000 818b03d0
2c0c0000 4082000c
399b0010 918b03d0
881b0010 00000000
c0000000 00000008
3d608000 a18b03b2
a0ab03b0 398c0001
2c0c0038 40a2001c
39800000 38a50001
2c050012 41a00008
38a00000 b0ab03b0
b18b03b2 4e800020
60000000 00000000
c0000000 0000000e
3d808000 816c03d0
88ac03b1 3d80804c
618cc000 a18c0f12
2c0c2001 38600000
41820040 2c0c2008
38600028 41820034
2c0c2002 38600050
41820028 2c0c4001
38600078 4182001c
2c0c4008 386000a0
41820010 2c0c4002
386000c8 4ca20020
7d6b1a14 98ab0000
4e800020 00000000
284ccf12 00006000
040003d0 00000000
e0000000 80008000

(Note)
Press and release C + Z at the "2 on 2," or "3 on 3" selection screen to reset the character mod pointer. This must be done every time!!!

In the character selection screen, after choosing all the characters, the select difficulty pop up will appear.
Press and hold one of the following button combinations to change the character you wish to mod. When the desired character is displayed
release the buttons. Choose difficulty level. Play the game.

Z + D-pad L (P1)
Z + D-pad U (AI 1)
Z + D-pad R (AI 2)
C + D-pad L (P2 or (AI 3)
C + D-pad U (AI 4)
C + D-pad R (AI 5)

Here's the source:

###This is setting up a pointer in EVA to P1’s character mod byte address.

c36035b0 00000004
3d608000 818b03d0
2c0c0000 4082000c
399b0010 918b03d0
881b0010 00000000

lis r11, 0x8000 #ASM Load upper half-word of EVA address
lwz r12, 0x3D0 (r11) #ASM Load lower half-word of EVA address
cmpwi r12, 0x0 #ASM Check to see if there’s an address already stored.
bne- def_code
addi r12, r27, 0x10 #ASM If no address is held in r12, add offset of 0x10
stw r12, 0X3D0 (r11) #ASM Then store true address in EVA

def_code:
lbz r0, 0X10 (r27) #ASM default code

###This is setting up the character mod value rotation in EVA

C0000000 00000008
3D608000 A18B03B2
A0AB03B0 398C0001
2C0C0040 40A2001C
39800000 38A50001
2C050012 41A00008
38A00000 B0AB03B0
B18B03B2 4E800020
60000000 00000000

lis r11, 0x8000 #ASM Load upper half-word of EVA address
lhz r12, 0x3b2 (r11) #ASM Load lower half-word of EVA address for interval timer.
lhz r5, 0x3b0 (r11) #ASM Load lower half-word of EVA address for character mod value cycling
addi r12, r12, 0x1 #ASM Add 0x1 to interval timer
cmpwi r12, 0x38 #ASM See if upper limit of interval timer has been reached; Adjust this for cycling speed
bne+ store_interval_timer #ASM if not reached, store the incremented value
li r12, 0x0 #ASM If it has been reached, load r12 to reset value to 0x0
addi r5, r5, 0x1 #ASM Load r5 to increment character mod value by 0x1
cmpwi r5, 0x12 #ASM See if upper limit of character mod value has been reached 0x11 (Black Mage)
blt+ store_char #ASM If not, store the incremented character mod value
li r5, 0x0 #ASM If it has been reached, load r5 to reset value to 0x0 (Mario)
store_char:
sth r5, 0x3b0 (r11) #ASM Store character mod value
store_interval_timer:
sth r12, 0x3b2 (r11) #ASM Store interval timer value
blr

###This is the button activator portion of the code

c0000000 0000000e
3d808000 816c03d0
88ac03b1 3d80804c
618cc000 a18c0f12
2c0c2001 38600000
41820040 2c0c2008
38600028 41820034
2c0c2002 38600050
41820028 2c0c4001
38600078 4182001c
2c0c4008 386000a0
41820010 2c0c4002
386000c8 4ca20020
7d6b1a14 98ab0000
4e800020 00000000

lis r12, 0x8000 #ASM Load upper half-word of EVA address
lwz r11, 0x3D0 (r12) #ASM Load r11 with P1’s character mod value address (base pointer)
lbz r5, 0x3B1 (r12) #ASM Load r5 cycling character mod value
lis r12, 0x804C #ASM Load upper half-word of button activator address
ori r12, r12, 0xC000 #ASM Load lower half-word of button activator address
lhz r12, 3858(r12) #ASM Load r12 with button activator value
cmpwi r12, 0x2001 #ASM Check to see if Z + D-pad L are being pressed
li r3, 0x0 #ASM If so, load offset added to pointer held in r11 for character mod value store (P1)
beq- store_it #ASM Just like it says
cmpwi r12, 0x2008 #ASM Check to see if Z + D-pad U are being pressed
li r3, 0x28 #ASM If so, load offset added to pointer held in r11 for character mod value store (AI1)
beq- store_it #ASM Just like it says
cmpwi r12, 0x2002 #ASM Check to see if Z + D-pad R are being pressed
li r3, 0x50 #ASM If so, load offset added to pointer held in r11 for character mod value store (AI2)
beq- store_it #ASM Just like it says
cmpwi r12, 0x4001 #ASM Check to see if C + D-pad L are being pressed
li r3, 0x78 #ASM If so, load offset added to pointer held in r11 for character mod value store (P2/AI3)
beq- store_it #ASM Just like it says
cmpwi r12, 0x4008 #ASM Check to see if C + D-pad U are being pressed
li r3, 0xA0 #ASM If so, load offset added to pointer held in r11 for character mod value store (AI4)
beq- store_it #ASM Just like it says
cmpwi r12, 0x4002 #ASM Check to see if C + D-pad R are being pressed
li r3, 0xC8 #ASM If so, load offset added to pointer held in r11 for character mod value store (AI5)
bnelr+ #ASM If correct combo of buttons are not pushed, branch to link register

store_it:
add r11, r11, r3 #ASM Add offset to P1’s Character mod value address stored in EVA
stb r5, 0(r11) #ASM Store character mod value to appropriate player/AI
blr #ASM We outta here

###This resets the pointer in EVA

284ccf12 00006000 #ASM See if C + Z are being pressed
040003d0 00000000 #ASM If so, reset pointer in EVA to 0x0
e0000000 80008000 #ASM Full terminator
Reply
I have a question.
As the code stands, it rotates through the character values 0x0 -> 0x11.
The value for the Mii character is 0x13. It skips 0x12
I've been driving myself nuts trying to rewrite this:

lis r11, 0x8000 #ASM Load upper half-word of EVA address
lhz r12, 0x3b2 (r11) #ASM Load lower half-word of EVA address for interval timer.
lhz r5, 0x3b0 (r11) #ASM Load lower half-word of EVA address for character mod value cycling
addi r12, r12, 0x1 #ASM Add 0x1 to interval timer
cmpwi r12, 0x38 #ASM See if upper limit of interval timer has been reached; Adjust this for cycling speed
bne+ store_interval_timer #ASM if not reached, store the incremented value
li r12, 0x0 #ASM If it has been reached, load r12 to reset value to 0x0
addi r5, r5, 0x1 #ASM Load r5 to increment character mod value by 0x1
cmpwi r5, 0x12 #ASM See if upper limit of character mod value has been reached 0x11 (Black Mage)
blt+ store_char #ASM If not, store the incremented character mod value
li r5, 0x0 #ASM If it has been reached, load r5 to reset value to 0x0 (Mario)
store_char:
sth r5, 0x3b0 (r11) #ASM Store character mod value
store_interval_timer:
sth r12, 0x3b2 (r11) #ASM Store interval timer value
blr

How would I do this. I know this is going to be one of those "oh crap, why didn't I think of that" moments.

Thanks!!!!!!!!!!!
Reply
Nevermind. I figured it out:

loc_0x0:
lis r11, 0x8000
lhz r12, 946(r11)
lhz r5, 944(r11)
addi r12, r12, 0x1
cmpwi r12, 0x38
bne+ store_rotation
li r12, 0x0
cmpwi r5, 0x11
beq- skip_twelve

addi r5, r5, 0x1
cmpwi r5, 0x14
blt+ store_char
li r5, 0x0

store_char:
sth r5, 944(r11)

store_rotation:
sth r12, 946(r11)
blr

skip_twelve:
addi r5, r5, 0x2
sth r5, 944(r11)
sth r12, 946(r11)
blr
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)