You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Graph optimisations
that actually work now
This commit is contained in:
12
Makefile
12
Makefile
@@ -153,12 +153,12 @@ LINK_LIBRARIES = $(foreach i,$(LIBRARIES),-l$(i))
|
||||
ifeq ($(COMPILER),gcc)
|
||||
NON_MATCHING := 1
|
||||
MIPSISET := -mips3
|
||||
OPT_FLAGS := -Os
|
||||
OPT_FLAGS := -Ofast
|
||||
else ifeq ($(COMPILER),clang)
|
||||
NON_MATCHING := 1
|
||||
# clang doesn't support ABI 'o32' for 'mips3'
|
||||
MIPSISET := -mips2
|
||||
OPT_FLAGS := -Os
|
||||
OPT_FLAGS := -Ofast
|
||||
endif
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ UNF ?= 0
|
||||
$(eval $(call validate-option,UNF,0 1))
|
||||
ifeq ($(UNF),1)
|
||||
DEFINES += UNF=1
|
||||
SRC_DIRS += src/usb
|
||||
SRC_DIRS += src/usbOfast
|
||||
USE_DEBUG := 1
|
||||
endif
|
||||
|
||||
@@ -394,8 +394,8 @@ export LD_LIBRARY_PATH=./tools
|
||||
AS := $(CROSS)as
|
||||
ifeq ($(COMPILER),gcc)
|
||||
CC := $(CROSS)gcc
|
||||
$(BUILD_DIR)/actors/%.o: OPT_FLAGS := -Os -mlong-calls
|
||||
$(BUILD_DIR)/levels/%.o: OPT_FLAGS := -Os -mlong-calls
|
||||
$(BUILD_DIR)/actors/%.o: OPT_FLAGS := -Ofast -mlong-calls
|
||||
$(BUILD_DIR)/levels/%.o: OPT_FLAGS := -Ofast -mlong-calls
|
||||
else ifeq ($(COMPILER),clang)
|
||||
CC := clang
|
||||
endif
|
||||
@@ -430,7 +430,7 @@ DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
|
||||
# C compiler options
|
||||
CFLAGS = -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS)
|
||||
ifeq ($(COMPILER),gcc)
|
||||
CFLAGS += -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra -Wno-missing-braces -fno-jump-tables
|
||||
CFLAGS += -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra -Wno-missing-braces
|
||||
else ifeq ($(COMPILER),clang)
|
||||
CFLAGS += -target mips -mabi=32 -G 0 -mhard-float -fomit-frame-pointer -fno-stack-protector -fno-common -I include -I src/ -I $(BUILD_DIR)/include -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra -Wno-missing-braces -fno-jump-tables
|
||||
else
|
||||
|
||||
46
asm/math.s
Normal file
46
asm/math.s
Normal file
@@ -0,0 +1,46 @@
|
||||
# assembler directives
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
.set gp=64
|
||||
|
||||
.include "macros.inc"
|
||||
|
||||
|
||||
.section .text, "ax"
|
||||
|
||||
.global mtxf_to_mtx_asm
|
||||
.balign 32
|
||||
mtxf_to_mtx_asm:
|
||||
addiu $v0, $zero, 0x0001
|
||||
lui $t2, 0x4780
|
||||
mtc1 $t2, $f4
|
||||
loop:
|
||||
lwc1 $f0, 0x0000($a1)
|
||||
andi $t0, $v0, 0x0002
|
||||
mul.s $f0, $f0, $f4
|
||||
lwc1 $f2, 0x0004($a1)
|
||||
trunc.w.s $f0, $f0
|
||||
mfc1 $t3, $f0
|
||||
addiu $a1, $a1, 0x0008
|
||||
sra $t4, $t3, 16
|
||||
sh $t4, 0x0000($a0)
|
||||
sh $t3, 0x0020($a0)
|
||||
bne $t0, $zero, storezero
|
||||
addiu $v0, $v0, 0x0002
|
||||
mul.s $f2, $f2, $f4
|
||||
addiu $t1, $zero, 1
|
||||
trunc.w.s $f2, $f2
|
||||
mfc1 $t3, $f2
|
||||
addiu $v1, $zero, 0x0011
|
||||
sra $t4, $t3, 16
|
||||
sh $t4, 0x0002($a0)
|
||||
sh $t3, 0x0022($a0)
|
||||
loopend:
|
||||
bne $v0, $v1, loop
|
||||
addiu $a0, $a0, 0x0004
|
||||
jr $ra
|
||||
sh $t1, -2 ($a0)
|
||||
storezero:
|
||||
sh $zero, 0x0002($a0)
|
||||
j loopend
|
||||
sh $zero, 0x0022($a0)
|
||||
1
sm64.ld
1
sm64.ld
@@ -245,6 +245,7 @@ SECTIONS
|
||||
{
|
||||
BUILD_DIR/src/game*.o(.text);
|
||||
BUILD_DIR/src/engine*.o(.text);
|
||||
BUILD_DIR/asm/math.o(.text);
|
||||
_engineSegmentTextEnd = .;
|
||||
/* data */
|
||||
BUILD_DIR/src/game*.o(.*data*);
|
||||
|
||||
@@ -66,7 +66,9 @@ extern struct MainPoolBlock *sPoolListHeadR;
|
||||
*/
|
||||
struct MemoryPool *gEffectsMemoryPool;
|
||||
|
||||
|
||||
uintptr_t sSegmentTable[32];
|
||||
uintptr_t sSegmentROMTable[32];
|
||||
u32 sPoolFreeSpace;
|
||||
u8 *sPoolStart;
|
||||
u8 *sPoolEnd;
|
||||
@@ -337,13 +339,13 @@ void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side, u8 *bssStart
|
||||
addr = dynamic_dma_read(srcStart, srcEnd, side, TLB_PAGE_SIZE, (uintptr_t)bssEnd - (uintptr_t)bssStart);
|
||||
if (addr != NULL) {
|
||||
u8 *realAddr = (u8 *)ALIGN((uintptr_t)addr, TLB_PAGE_SIZE);
|
||||
set_segment_base_addr(segment, realAddr);
|
||||
set_segment_base_addr(segment, realAddr); sSegmentROMTable[segment] = (uintptr_t) srcStart;
|
||||
mapTLBPages(segment << 24, VIRTUAL_TO_PHYSICAL(realAddr), (srcEnd - srcStart) + ((uintptr_t)bssEnd - (uintptr_t)bssStart), segment);
|
||||
}
|
||||
} else {
|
||||
addr = dynamic_dma_read(srcStart, srcEnd, side, 0, 0);
|
||||
if (addr != NULL) {
|
||||
set_segment_base_addr(segment, addr);
|
||||
set_segment_base_addr(segment, addr); sSegmentROMTable[segment] = (uintptr_t) srcStart;
|
||||
}
|
||||
}
|
||||
#if PUPPYPRINT_DEBUG
|
||||
@@ -418,7 +420,7 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
decompress(compressed, dest);
|
||||
#endif
|
||||
osSyncPrintf("end decompress\n");
|
||||
set_segment_base_addr(segment, dest);
|
||||
set_segment_base_addr(segment, dest); sSegmentROMTable[segment] = (uintptr_t) srcStart;
|
||||
main_pool_free(compressed);
|
||||
}
|
||||
}
|
||||
@@ -457,7 +459,7 @@ void *load_segment_decompress_heap(u32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
#elif MIO0
|
||||
decompress(compressed, gDecompressionHeap);
|
||||
#endif
|
||||
set_segment_base_addr(segment, gDecompressionHeap);
|
||||
set_segment_base_addr(segment, gDecompressionHeap); sSegmentROMTable[segment] = (uintptr_t) srcStart;
|
||||
main_pool_free(compressed);
|
||||
}
|
||||
return gDecompressionHeap;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user