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


Forum Jump:


Users browsing this thread: 1 Guest(s)