Skip to content

Commit 4f69a6b

Browse files
committed
Initial commit
1 parent 19e43ad commit 4f69a6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+10979
-17
lines changed

.gitattributes

-17
This file was deleted.

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
/*.elf

LICENSE

+674
Large diffs are not rendered by default.

Makefile

+218
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
#---------------------------------------------------------------------------------
2+
# Clear the implicit built in rules
3+
#---------------------------------------------------------------------------------
4+
.SUFFIXES:
5+
#---------------------------------------------------------------------------------
6+
ifeq ($(strip $(DEVKITPPC)),)
7+
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
8+
endif
9+
ifeq ($(strip $(DEVKITPRO)),)
10+
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
11+
endif
12+
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
13+
export LIBOGC_INC := $(DEVKITPRO)/libogc/include
14+
export LIBOGC_LIB := $(DEVKITPRO)/libogc/lib/wii
15+
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
16+
17+
PREFIX := powerpc-eabi-
18+
19+
export AS := $(PREFIX)as
20+
export CC := $(PREFIX)gcc
21+
export CXX := $(PREFIX)g++
22+
export AR := $(PREFIX)ar
23+
export OBJCOPY := $(PREFIX)objcopy
24+
25+
#---------------------------------------------------------------------------------
26+
# TARGET is the name of the output
27+
# BUILD is the directory where object files & intermediate files will be placed
28+
# SOURCES is a list of directories containing source code
29+
# INCLUDES is a list of directories containing extra header files
30+
#---------------------------------------------------------------------------------
31+
TARGET := tcpgecko
32+
BUILD := build
33+
BUILD_DBG := $(TARGET)_dbg
34+
SOURCES := src \
35+
src/dynamic_libs \
36+
src/game \
37+
src/fs \
38+
src/kernel \
39+
src/patcher \
40+
src/system \
41+
src/utils
42+
DATA :=
43+
44+
INCLUDES := src
45+
46+
#---------------------------------------------------------------------------------
47+
# options for code generation
48+
#---------------------------------------------------------------------------------
49+
CFLAGS := -std=gnu11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \
50+
-O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
51+
CXXFLAGS := -std=gnu++11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \
52+
-O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
53+
ASFLAGS := -mregnames
54+
LDFLAGS := -nostartfiles -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,-wrap,valloc,-wrap,_valloc_r,-wrap,_pvalloc_r,--gc-sections
55+
56+
#---------------------------------------------------------------------------------
57+
Q := @
58+
MAKEFLAGS += --no-print-directory
59+
#---------------------------------------------------------------------------------
60+
# any extra libraries we wish to link with the project
61+
#---------------------------------------------------------------------------------
62+
LIBS :=
63+
64+
#---------------------------------------------------------------------------------
65+
# list of directories containing libraries, this must be the top level containing
66+
# include and lib
67+
#---------------------------------------------------------------------------------
68+
LIBDIRS := $(CURDIR) \
69+
$(DEVKITPPC)/lib \
70+
$(DEVKITPPC)/lib/gcc/powerpc-eabi/4.8.2
71+
72+
73+
#---------------------------------------------------------------------------------
74+
# no real need to edit anything past this point unless you need to add additional
75+
# rules for different file extensions
76+
#---------------------------------------------------------------------------------
77+
ifneq ($(BUILD),$(notdir $(CURDIR)))
78+
#---------------------------------------------------------------------------------
79+
export PROJECTDIR := $(CURDIR)
80+
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
81+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
82+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
83+
export DEPSDIR := $(CURDIR)/$(BUILD)
84+
85+
#---------------------------------------------------------------------------------
86+
# automatically build a list of object files for our project
87+
#---------------------------------------------------------------------------------
88+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
89+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
90+
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
91+
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
92+
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
93+
TTFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ttf)))
94+
PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png)))
95+
96+
#---------------------------------------------------------------------------------
97+
# use CXX for linking C++ projects, CC for standard C
98+
#---------------------------------------------------------------------------------
99+
ifeq ($(strip $(CPPFILES)),)
100+
export LD := $(CC)
101+
else
102+
export LD := $(CXX)
103+
endif
104+
105+
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
106+
$(sFILES:.s=.o) $(SFILES:.S=.o) \
107+
$(PNGFILES:.png=.png.o) $(addsuffix .o,$(BINFILES))
108+
109+
#---------------------------------------------------------------------------------
110+
# build a list of include paths
111+
#---------------------------------------------------------------------------------
112+
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
113+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
114+
-I$(CURDIR)/$(BUILD) -I$(LIBOGC_INC) \
115+
-I$(PORTLIBS)/include -I$(PORTLIBS)/include/freetype2
116+
117+
#---------------------------------------------------------------------------------
118+
# build a list of library paths
119+
#---------------------------------------------------------------------------------
120+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
121+
-L$(LIBOGC_LIB) -L$(PORTLIBS)/lib
122+
123+
export OUTPUT := $(CURDIR)/$(TARGET)
124+
.PHONY: $(BUILD) clean install
125+
126+
#---------------------------------------------------------------------------------
127+
$(BUILD):
128+
@[ -d $@ ] || mkdir -p $@
129+
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
130+
131+
#---------------------------------------------------------------------------------
132+
clean:
133+
@echo clean ...
134+
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).bin $(BUILD_DBG).elf
135+
136+
#---------------------------------------------------------------------------------
137+
else
138+
139+
DEPENDS := $(OFILES:.o=.d)
140+
141+
#---------------------------------------------------------------------------------
142+
# main targets
143+
#---------------------------------------------------------------------------------
144+
$(OUTPUT).elf: $(OFILES)
145+
146+
#---------------------------------------------------------------------------------
147+
# This rule links in binary data with the .jpg extension
148+
#---------------------------------------------------------------------------------
149+
%.elf: link.ld $(OFILES)
150+
@echo "linking ... $(TARGET).elf"
151+
$(Q)$(LD) -n -T $^ $(LDFLAGS) -o ../$(BUILD_DBG).elf $(LIBPATHS) $(LIBS)
152+
$(Q)$(OBJCOPY) -S -R .comment -R .gnu.attributes ../$(BUILD_DBG).elf $@
153+
154+
../data/loader.bin:
155+
$(MAKE) -C ../loader clean
156+
$(MAKE) -C ../loader
157+
#---------------------------------------------------------------------------------
158+
%.a:
159+
#---------------------------------------------------------------------------------
160+
@echo $(notdir $@)
161+
@rm -f $@
162+
@$(AR) -rc $@ $^
163+
164+
#---------------------------------------------------------------------------------
165+
%.o: %.cpp
166+
@echo $(notdir $<)
167+
@$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
168+
169+
#---------------------------------------------------------------------------------
170+
%.o: %.c
171+
@echo $(notdir $<)
172+
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER)
173+
174+
#---------------------------------------------------------------------------------
175+
%.o: %.S
176+
@echo $(notdir $<)
177+
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
178+
179+
#---------------------------------------------------------------------------------
180+
%.png.o : %.png
181+
@echo $(notdir $<)
182+
@bin2s -a 32 $< | $(AS) -o $(@)
183+
184+
#---------------------------------------------------------------------------------
185+
%.jpg.o : %.jpg
186+
@echo $(notdir $<)
187+
@bin2s -a 32 $< | $(AS) -o $(@)
188+
189+
#---------------------------------------------------------------------------------
190+
%.ttf.o : %.ttf
191+
@echo $(notdir $<)
192+
@bin2s -a 32 $< | $(AS) -o $(@)
193+
194+
#---------------------------------------------------------------------------------
195+
%.bin.o : %.bin
196+
@echo $(notdir $<)
197+
@bin2s -a 32 $< | $(AS) -o $(@)
198+
199+
#---------------------------------------------------------------------------------
200+
%.wav.o : %.wav
201+
@echo $(notdir $<)
202+
@bin2s -a 32 $< | $(AS) -o $(@)
203+
204+
#---------------------------------------------------------------------------------
205+
%.mp3.o : %.mp3
206+
@echo $(notdir $<)
207+
@bin2s -a 32 $< | $(AS) -o $(@)
208+
209+
#---------------------------------------------------------------------------------
210+
%.ogg.o : %.ogg
211+
@echo $(notdir $<)
212+
@bin2s -a 32 $< | $(AS) -o $(@)
213+
214+
-include $(DEPENDS)
215+
216+
#---------------------------------------------------------------------------------
217+
endif
218+
#---------------------------------------------------------------------------------

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# TCPGecko
2+
TCPGecko Installer

codehandler.bin

12.9 KB
Binary file not shown.

meta/icon.png

36.9 KB
Loading

meta/meta.xml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<app version="1">
3+
<name>TCPgecko</name>
4+
<coder>Wj44</coder>
5+
<version>1.1</version>
6+
<release_date>20160503120400</release_date>
7+
<short_description>WiiU RAM Hacking</short_description>
8+
<long_description>A memory editor that does magical things to your games. In order to apply Cafe Codes (real-time cheats) use JGecko U.
9+
Special Thanks to:
10+
Chadderz, Marionumber1 - TCPGecko codehandler
11+
pwsincd - icon and xml
12+
CosmoCortney - codehandler for cheat codes, xml
13+
</long_description>
14+
</app>

src/common/common.h

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#ifndef COMMON_H
2+
#define COMMON_H
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#include "os_defs.h"
9+
10+
#define INSTALL_ADDR 0x010F4000
11+
12+
#define CAFE_OS_SD_PATH "/vol/external01"
13+
#define SD_PATH "sd:"
14+
#define WIIU_PATH "/wiiu"
15+
16+
/* Macros for libs */
17+
#define LIB_CORE_INIT 0
18+
#define LIB_NSYSNET 1
19+
#define LIB_GX2 2
20+
// none dynamic libs
21+
#define LIB_LOADER 0x1001
22+
23+
24+
#ifndef MEM_BASE
25+
#define MEM_BASE (0x00800000)
26+
#endif
27+
28+
#define ELF_DATA_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x00))
29+
#define ELF_DATA_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x04))
30+
#define MAIN_ENTRY_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x00))
31+
#define OS_FIRMWARE (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x04))
32+
33+
#define OS_SPECIFICS ((OsSpecifics*)(MEM_BASE + 0x1500))
34+
35+
#ifndef EXIT_SUCCESS
36+
#define EXIT_SUCCESS 0
37+
#endif
38+
#define EXIT_HBL_EXIT 0xFFFFFFFE
39+
#define EXIT_RELAUNCH_ON_LOAD 0xFFFFFFFD
40+
41+
#define RESTORE_INSTR_MAGIC 0xC001C0DE
42+
#define RESTORE_INSTR_ADDR ((restore_instructions_t*)(MEM_BASE + 0x1600))
43+
44+
typedef struct _restore_instructions_t {
45+
unsigned int magic;
46+
unsigned int instr_count;
47+
struct {
48+
unsigned int addr;
49+
unsigned int instr;
50+
} data[0];
51+
} restore_instructions_t;
52+
53+
#ifdef __cplusplus
54+
}
55+
#endif
56+
57+
#endif /* COMMON_H */
58+

src/common/fs_defs.h

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#ifndef FS_DEFS_H
2+
#define FS_DEFS_H
3+
4+
#include "types.h"
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
11+
/* FS defines and types */
12+
#define FS_MAX_LOCALPATH_SIZE 511
13+
#define FS_MAX_MOUNTPATH_SIZE 128
14+
#define FS_MAX_FULLPATH_SIZE (FS_MAX_LOCALPATH_SIZE + FS_MAX_MOUNTPATH_SIZE)
15+
#define FS_MAX_ARGPATH_SIZE FS_MAX_FULLPATH_SIZE
16+
17+
#define FS_STATUS_OK 0
18+
#define FS_STATUS_EXISTS -5
19+
#define FS_STATUS_STORAGE_FULL -12
20+
#define FS_STATUS_JOURNAL_FULL -13
21+
22+
#define FS_RET_UNSUPPORTED_CMD 0x0400
23+
#define FS_RET_NO_ERROR 0x0000
24+
#define FS_RET_ALL_ERROR (unsigned int)(-1)
25+
26+
27+
#define FS_STAT_FLAG_IS_DIRECTORY 0x80000000
28+
29+
/* max length of file/dir name */
30+
#define FS_MAX_ENTNAME_SIZE 256
31+
32+
#define FS_SOURCETYPE_EXTERNAL 0
33+
#define FS_SOURCETYPE_HFIO 1
34+
#define FS_SOURCETYPE_HFIO 1
35+
36+
#define FS_MOUNT_SOURCE_SIZE 0x300
37+
#define FS_CLIENT_SIZE 0x1700
38+
#define FS_CMD_BLOCK_SIZE 0xA80
39+
40+
typedef struct
41+
{
42+
uint32_t flag;
43+
uint32_t permission;
44+
uint32_t owner_id;
45+
uint32_t group_id;
46+
uint32_t size;
47+
uint32_t alloc_size;
48+
uint64_t quota_size;
49+
uint32_t ent_id;
50+
uint64_t ctime;
51+
uint64_t mtime;
52+
uint8_t attributes[48];
53+
} __attribute__((packed)) FSStat;
54+
55+
typedef struct
56+
{
57+
FSStat stat;
58+
char name[FS_MAX_ENTNAME_SIZE];
59+
} FSDirEntry;
60+
61+
62+
#ifdef __cplusplus
63+
}
64+
#endif
65+
66+
#endif /* FS_DEFS_H */
67+

0 commit comments

Comments
 (0)