Skip to content

Commit

Permalink
- Fix one problem preventing enablement of -msdata.
Browse files Browse the repository at this point in the history
- Update .gitignore.
  • Loading branch information
Extrems committed Apr 28, 2023
1 parent 501f5a5 commit 0d55943
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 153 deletions.
30 changes: 11 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
/dist
/swiss_r*

cube/swiss/build/
cube/swiss/dist/

cube/swiss/source/patches/*.s
cube/patches/disassembly

cube/actionreplay/SDLOADER.BIN

pc/usbgecko/swissserver
pc/usbgecko/swissserver.exe
pc/usbgecko/core
pc/usbgecko/core.*

*.d
*.dol
*.elf
*.o
*.d
*.map
*.gcm
*.o
/cube/packer/SDLOADER.BIN
/cube/patches/disassembly
/cube/swiss/source/patches/*.bin.s
/cube/swiss/source/patches/*_bin.h
/pc/usbgecko/swissserver
/pc/usbgecko/swissserver.exe
/swiss_r*
build
dist
56 changes: 28 additions & 28 deletions cube/patches/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gcloaderpatch: gcloader-v1.bin gcloader-v1.card.bin gcloader-v2.bin gcloader-v2.

clean:
@rm -f *.bin *.elf *.o
@rm -f $(DEST)/*.s
@rm -f $(DEST)/*.bin.s $(DEST)/*_bin.h
@rm -fr $(DISASM)

cpatches:
Expand All @@ -43,10 +43,10 @@ cpatches:
@$(OBJCOPY) -O binary memcpy.o memcpy.bin
@$(OBJCOPY) -O binary CheckStatus.elf CheckStatus.bin
@$(OBJCOPY) -O binary WriteUARTN.elf WriteUARTN.bin
@$(BIN2S) backwards_memcpy.bin > $(DEST)/backwards_memcpy.s
@$(BIN2S) memcpy.bin > $(DEST)/memcpy.s
@$(BIN2S) CheckStatus.bin > $(DEST)/CheckStatus.s
@$(BIN2S) WriteUARTN.bin > $(DEST)/WriteUARTN.s
@$(BIN2S) -H $(DEST)/backwards_memcpy_bin.h backwards_memcpy.bin > $(DEST)/backwards_memcpy.bin.s
@$(BIN2S) -H $(DEST)/memcpy_bin.h memcpy.bin > $(DEST)/memcpy.bin.s
@$(BIN2S) -H $(DEST)/CheckStatus_bin.h CheckStatus.bin > $(DEST)/CheckStatus.bin.s
@$(BIN2S) -H $(DEST)/WriteUARTN_bin.h WriteUARTN.bin > $(DEST)/WriteUARTN.bin.s
@rm -f *.bin *.elf *.o

reboot.bin:
Expand All @@ -62,7 +62,7 @@ reboot.bin:
@$(OBJDUMP) -D reboot.elf > $(DISASM)/reboot.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents reboot.elf reboot.bin
@truncate -s %32 reboot.bin
@$(BIN2S) reboot.bin > $(DEST)/Reboot.s
@$(BIN2S) -H $(DEST)/reboot_bin.h reboot.bin > $(DEST)/reboot.bin.s
@rm -f *.bin *.elf *.o

stub.bin:
Expand All @@ -77,7 +77,7 @@ stub.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D stub.elf > $(DISASM)/stub.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents stub.elf stub.bin
@$(BIN2S) stub.bin > $(DEST)/Stub.s
@$(BIN2S) -H $(DEST)/stub_bin.h stub.bin > $(DEST)/stub.bin.s
@rm -f *.bin *.elf *.o

sd.bin:
Expand All @@ -101,7 +101,7 @@ sd.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D sd.elf > $(DISASM)/sd.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents sd.elf sd.bin
@$(BIN2S) sd.bin > $(DEST)/SlotAB-SD.s
@$(BIN2S) -H $(DEST)/sd_bin.h sd.bin > $(DEST)/sd.bin.s
@rm -f *.bin *.elf *.o

sd.card.bin:
Expand All @@ -122,7 +122,7 @@ sd.card.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D sd.card.elf > $(DISASM)/sd.card.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents sd.card.elf sd.card.bin
@$(BIN2S) sd.card.bin > $(DEST)/SlotAB-SD.card.s
@$(BIN2S) -H $(DEST)/sd_card_bin.h sd.card.bin > $(DEST)/sd.card.bin.s
@rm -f *.bin *.elf *.o

sd.dtk.bin:
Expand All @@ -144,7 +144,7 @@ sd.dtk.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D sd.dtk.elf > $(DISASM)/sd.dtk.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents sd.dtk.elf sd.dtk.bin
@$(BIN2S) sd.dtk.bin > $(DEST)/SlotAB-SD.dtk.s
@$(BIN2S) -H $(DEST)/sd_dtk_bin.h sd.dtk.bin > $(DEST)/sd.dtk.bin.s
@rm -f *.bin *.elf *.o

ideexi-v1.bin:
Expand All @@ -168,7 +168,7 @@ ideexi-v1.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D ideexi-v1.elf > $(DISASM)/ideexi-v1.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents ideexi-v1.elf ideexi-v1.bin
@$(BIN2S) ideexi-v1.bin > $(DEST)/SlotAB-IDEEXI_V1.s
@$(BIN2S) -H $(DEST)/ideexi_v1_bin.h ideexi-v1.bin > $(DEST)/ideexi-v1.bin.s
@rm -f *.bin *.elf *.o

ideexi-v1.card.bin:
Expand All @@ -189,7 +189,7 @@ ideexi-v1.card.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D ideexi-v1.card.elf > $(DISASM)/ideexi-v1.card.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents ideexi-v1.card.elf ideexi-v1.card.bin
@$(BIN2S) ideexi-v1.card.bin > $(DEST)/SlotAB-IDEEXI_V1.card.s
@$(BIN2S) -H $(DEST)/ideexi_v1_card_bin.h ideexi-v1.card.bin > $(DEST)/ideexi-v1.card.bin.s
@rm -f *.bin *.elf *.o

ideexi-v1.dtk.bin:
Expand All @@ -211,7 +211,7 @@ ideexi-v1.dtk.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D ideexi-v1.dtk.elf > $(DISASM)/ideexi-v1.dtk.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents ideexi-v1.dtk.elf ideexi-v1.dtk.bin
@$(BIN2S) ideexi-v1.dtk.bin > $(DEST)/SlotAB-IDEEXI_V1.dtk.s
@$(BIN2S) -H $(DEST)/ideexi_v1_dtk_bin.h ideexi-v1.dtk.bin > $(DEST)/ideexi-v1.dtk.bin.s
@rm -f *.bin *.elf *.o

ideexi-v2.bin:
Expand All @@ -235,7 +235,7 @@ ideexi-v2.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D ideexi-v2.elf > $(DISASM)/ideexi-v2.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents ideexi-v2.elf ideexi-v2.bin
@$(BIN2S) ideexi-v2.bin > $(DEST)/SlotAB-IDEEXI_V2.s
@$(BIN2S) -H $(DEST)/ideexi_v2_bin.h ideexi-v2.bin > $(DEST)/ideexi-v2.bin.s
@rm -f *.bin *.elf *.o

ideexi-v2.card.bin:
Expand All @@ -256,7 +256,7 @@ ideexi-v2.card.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D ideexi-v2.card.elf > $(DISASM)/ideexi-v2.card.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents ideexi-v2.card.elf ideexi-v2.card.bin
@$(BIN2S) ideexi-v2.card.bin > $(DEST)/SlotAB-IDEEXI_V2.card.s
@$(BIN2S) -H $(DEST)/ideexi_v2_card_bin.h ideexi-v2.card.bin > $(DEST)/ideexi-v2.card.bin.s
@rm -f *.bin *.elf *.o

ideexi-v2.dtk.bin:
Expand All @@ -278,7 +278,7 @@ ideexi-v2.dtk.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D ideexi-v2.dtk.elf > $(DISASM)/ideexi-v2.dtk.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents ideexi-v2.dtk.elf ideexi-v2.dtk.bin
@$(BIN2S) ideexi-v2.dtk.bin > $(DEST)/SlotAB-IDEEXI_V2.dtk.s
@$(BIN2S) -H $(DEST)/ideexi_v2_dtk_bin.h ideexi-v2.dtk.bin > $(DEST)/ideexi-v2.dtk.bin.s
@rm -f *.bin *.elf *.o

dvd.bin:
Expand All @@ -298,7 +298,7 @@ dvd.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D dvd.elf > $(DISASM)/dvd.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents dvd.elf dvd.bin
@$(BIN2S) dvd.bin > $(DEST)/DVDPatch.s
@$(BIN2S) -H $(DEST)/dvd_bin.h dvd.bin > $(DEST)/dvd.bin.s
@rm -f *.bin *.elf *.o

dvd.card.bin:
Expand All @@ -319,7 +319,7 @@ dvd.card.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D dvd.card.elf > $(DISASM)/dvd.card.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents dvd.card.elf dvd.card.bin
@$(BIN2S) dvd.card.bin > $(DEST)/DVDPatch.card.s
@$(BIN2S) -H $(DEST)/dvd_card_bin.h dvd.card.bin > $(DEST)/dvd.card.bin.s
@rm -f *.bin *.elf *.o

usbgecko.bin:
Expand All @@ -338,7 +338,7 @@ usbgecko.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D usbgecko.elf > $(DISASM)/usbgecko.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents usbgecko.elf usbgecko.bin
@$(BIN2S) usbgecko.bin > $(DEST)/USBGeckoPatch.s
@$(BIN2S) -H $(DEST)/usbgecko_bin.h usbgecko.bin > $(DEST)/usbgecko.bin.s
@rm -f *.bin *.elf *.o

wkf.bin:
Expand All @@ -358,7 +358,7 @@ wkf.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D wkf.elf > $(DISASM)/wkf.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents wkf.elf wkf.bin
@$(BIN2S) wkf.bin > $(DEST)/WKFPatch.s
@$(BIN2S) -H $(DEST)/wkf_bin.h wkf.bin > $(DEST)/wkf.bin.s
@rm -f *.bin *.elf *.o

wkf.card.bin:
Expand All @@ -379,7 +379,7 @@ wkf.card.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D wkf.card.elf > $(DISASM)/wkf.card.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents wkf.card.elf wkf.card.bin
@$(BIN2S) wkf.card.bin > $(DEST)/WKFPatch.card.s
@$(BIN2S) -H $(DEST)/wkf_card_bin.h wkf.card.bin > $(DEST)/wkf.card.bin.s
@rm -f *.bin *.elf *.o

wkf.dtk.bin:
Expand All @@ -401,7 +401,7 @@ wkf.dtk.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D wkf.dtk.elf > $(DISASM)/wkf.dtk.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents wkf.dtk.elf wkf.dtk.bin
@$(BIN2S) wkf.dtk.bin > $(DEST)/WKFPatch.dtk.s
@$(BIN2S) -H $(DEST)/wkf_dtk_bin.h wkf.dtk.bin > $(DEST)/wkf.dtk.bin.s
@rm -f *.bin *.elf *.o

fsp.bin:
Expand All @@ -422,7 +422,7 @@ fsp.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D fsp.elf > $(DISASM)/fsp.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents fsp.elf fsp.bin
@$(BIN2S) fsp.bin > $(DEST)/FSPPatch.s
@$(BIN2S) -H $(DEST)/fsp_bin.h fsp.bin > $(DEST)/fsp.bin.s
@rm -f *.bin *.elf *.o

fsp.dtk.bin:
Expand All @@ -443,7 +443,7 @@ fsp.dtk.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D fsp.dtk.elf > $(DISASM)/fsp.dtk.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents fsp.dtk.elf fsp.dtk.bin
@$(BIN2S) fsp.dtk.bin > $(DEST)/FSPPatch.dtk.s
@$(BIN2S) -H $(DEST)/fsp_dtk_bin.h fsp.dtk.bin > $(DEST)/fsp.dtk.bin.s
@rm -f *.bin *.elf *.o

gcloader-v1.bin:
Expand All @@ -467,7 +467,7 @@ gcloader-v1.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D gcloader-v1.elf > $(DISASM)/gcloader-v1.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents gcloader-v1.elf gcloader-v1.bin
@$(BIN2S) gcloader-v1.bin > $(DEST)/GCLoaderPatch1.s
@$(BIN2S) -H $(DEST)/gcloader_v1_bin.h gcloader-v1.bin > $(DEST)/gcloader-v1.bin.s
@rm -f *.bin *.elf *.o

gcloader-v1.card.bin:
Expand All @@ -488,7 +488,7 @@ gcloader-v1.card.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D gcloader-v1.card.elf > $(DISASM)/gcloader-v1.card.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents gcloader-v1.card.elf gcloader-v1.card.bin
@$(BIN2S) gcloader-v1.card.bin > $(DEST)/GCLoaderPatch1.card.s
@$(BIN2S) -H $(DEST)/gcloader_v1_card_bin.h gcloader-v1.card.bin > $(DEST)/gcloader-v1.card.bin.s
@rm -f *.bin *.elf *.o

gcloader-v2.bin:
Expand All @@ -510,7 +510,7 @@ gcloader-v2.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D gcloader-v2.elf > $(DISASM)/gcloader-v2.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents gcloader-v2.elf gcloader-v2.bin
@$(BIN2S) gcloader-v2.bin > $(DEST)/GCLoaderPatch2.s
@$(BIN2S) -H $(DEST)/gcloader_v2_bin.h gcloader-v2.bin > $(DEST)/gcloader-v2.bin.s
@rm -f *.bin *.elf *.o

gcloader-v2.card.bin:
Expand All @@ -529,5 +529,5 @@ gcloader-v2.card.bin:
@mkdir -p $(DISASM)
@$(OBJDUMP) -D gcloader-v2.card.elf > $(DISASM)/gcloader-v2.card.txt
@$(OBJCOPY) -O binary --set-section-flags .bss.*=alloc,load,contents gcloader-v2.card.elf gcloader-v2.card.bin
@$(BIN2S) gcloader-v2.card.bin > $(DEST)/GCLoaderPatch2.card.s
@$(BIN2S) -H $(DEST)/gcloader_v2_card_bin.h gcloader-v2.card.bin > $(DEST)/gcloader-v2.card.bin.s
@rm -f *.bin *.elf *.o
87 changes: 30 additions & 57 deletions cube/swiss/include/patcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,69 +11,43 @@ typedef struct FuncPattern
u32 FCalls;
u32 Branch;
u32 Moves;
u8 *Patch;
const void *Patch;
u32 PatchLength;
char *Name;
const char *Name;
u32 offsetFoundAt;
} FuncPattern;

/* the SDGecko/IDE-EXI patches */
extern u8 reboot_bin[];
extern u32 reboot_bin_size;
extern u8 stub_bin[];
extern u32 stub_bin_size;
extern u8 ideexi_v1_bin[];
extern u32 ideexi_v1_bin_size;
extern u8 ideexi_v1_card_bin[];
extern u32 ideexi_v1_card_bin_size;
extern u8 ideexi_v1_dtk_bin[];
extern u32 ideexi_v1_dtk_bin_size;
extern u8 ideexi_v2_bin[];
extern u32 ideexi_v2_bin_size;
extern u8 ideexi_v2_card_bin[];
extern u32 ideexi_v2_card_bin_size;
extern u8 ideexi_v2_dtk_bin[];
extern u32 ideexi_v2_dtk_bin_size;
extern u8 sd_bin[];
extern u32 sd_bin_size;
extern u8 sd_card_bin[];
extern u32 sd_card_bin_size;
extern u8 sd_dtk_bin[];
extern u32 sd_dtk_bin_size;
extern u8 usbgecko_bin[];
extern u32 usbgecko_bin_size;
extern u8 wkf_bin[];
extern u32 wkf_bin_size;
extern u8 wkf_card_bin[];
extern u32 wkf_card_bin_size;
extern u8 wkf_dtk_bin[];
extern u32 wkf_dtk_bin_size;
extern u8 dvd_bin[];
extern u32 dvd_bin_size;
extern u8 dvd_card_bin[];
extern u32 dvd_card_bin_size;
extern u8 fsp_bin[];
extern u32 fsp_bin_size;
extern u8 fsp_dtk_bin[];
extern u32 fsp_dtk_bin_size;
extern u8 gcloader_v1_bin[];
extern u32 gcloader_v1_bin_size;
extern u8 gcloader_v1_card_bin[];
extern u32 gcloader_v1_card_bin_size;
extern u8 gcloader_v2_bin[];
extern u32 gcloader_v2_bin_size;
extern u8 gcloader_v2_card_bin[];
extern u32 gcloader_v2_card_bin_size;
#include "reboot_bin.h"
#include "stub_bin.h"
#include "sd_bin.h"
#include "sd_card_bin.h"
#include "sd_dtk_bin.h"
#include "ideexi_v1_bin.h"
#include "ideexi_v1_card_bin.h"
#include "ideexi_v1_dtk_bin.h"
#include "ideexi_v2_bin.h"
#include "ideexi_v2_card_bin.h"
#include "ideexi_v2_dtk_bin.h"
#include "dvd_bin.h"
#include "dvd_card_bin.h"
#include "usbgecko_bin.h"
#include "wkf_bin.h"
#include "wkf_card_bin.h"
#include "wkf_dtk_bin.h"
#include "fsp_bin.h"
#include "fsp_dtk_bin.h"
#include "gcloader_v1_bin.h"
#include "gcloader_v1_card_bin.h"
#include "gcloader_v2_bin.h"
#include "gcloader_v2_card_bin.h"

/* SDK patches */
extern u8 backwards_memcpy_bin[];
extern u32 backwards_memcpy_bin_size;
extern u8 memcpy_bin[];
extern u32 memcpy_bin_size;
#include "backwards_memcpy_bin.h"
#include "memcpy_bin.h"
extern u8 DVDLowTestAlarmHook[];
extern u32 DVDLowTestAlarmHook_length;
extern u8 WriteUARTN_bin[];
extern u32 WriteUARTN_bin_size;
#include "WriteUARTN_bin.h"
extern u8 GXAdjustForOverscanPatch[];
extern u32 GXAdjustForOverscanPatch_length;
extern u8 GXCopyDispHook[];
Expand Down Expand Up @@ -118,8 +92,7 @@ extern u8 MTXOrthoHook[];
extern u32 MTXOrthoHook_length;
extern u8 MTXPerspectiveHook[];
extern u32 MTXPerspectiveHook_length;
extern u8 CheckStatus_bin[];
extern u32 CheckStatus_bin_size;
#include "CheckStatus_bin.h"
extern u8 getTimingPatch[];
extern u32 getTimingPatch_length;
extern u8 VIConfigure240p[];
Expand Down Expand Up @@ -236,7 +209,7 @@ void *Calc_Address(void *data, int dataType, u32 properAddress);
int Patch_CheatsHook(u8 *data, u32 length, u32 type);
int Patch_ExecutableFile(void **buffer, u32 *sizeToRead, const char *gameID, int type);
void *installPatch(int patchId);
void *installPatch2(void *patchLocation, u32 patchSize);
void *installPatch2(const void *patch, u32 patchSize);
void *getPatchAddr(int patchId);
void setTopAddr(u32 addr);
u32 getTopAddr();
Expand Down
2 changes: 1 addition & 1 deletion cube/swiss/source/devices/deviceHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ typedef s32 (* _fn_makeDir)(file_handle*);
typedef s32 (* _fn_readDir)(file_handle*, file_handle**, u32);
typedef s64 (* _fn_seekFile)(file_handle*, s64, u32);
typedef s32 (* _fn_readFile)(file_handle*, void*, u32);
typedef s32 (* _fn_writeFile)(file_handle*, void*, u32);
typedef s32 (* _fn_writeFile)(file_handle*, const void*, u32);
typedef s32 (* _fn_closeFile)(file_handle*);
typedef s32 (* _fn_deleteFile)(file_handle*);
typedef s32 (* _fn_renameFile)(file_handle*, char*);
Expand Down
2 changes: 1 addition & 1 deletion cube/swiss/source/devices/fat/deviceHandler-FAT.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ s32 deviceHandler_FAT_readFile(file_handle* file, void* buffer, u32 length) {
return bytes_read;
}

s32 deviceHandler_FAT_writeFile(file_handle* file, void* buffer, u32 length) {
s32 deviceHandler_FAT_writeFile(file_handle* file, const void* buffer, u32 length) {
if(!file->ffsFp) {
file->ffsFp = malloc(sizeof(FIL));
if(f_open(file->ffsFp, file->name, FA_CREATE_ALWAYS | FA_WRITE ) != FR_OK) {
Expand Down
Loading

0 comments on commit 0d55943

Please sign in to comment.