diff --git a/Makefile b/Makefile index ea5ac7ce7..2690c3eae 100644 --- a/Makefile +++ b/Makefile @@ -58,9 +58,14 @@ else endif MIPSISET := -mips2 -32 +OPT_LVL := -O2 -$(B_DIR)/lib/libc/llcvt.o: MIPSISET := -mips3 -o32 $(B_DIR)/lib/libc/ll.o: MIPSISET := -mips3 -o32 +$(B_DIR)/lib/libc/llcvt.o: MIPSISET := -mips3 -o32 + +$(B_DIR)/lib/libc/ll.o: OPT_LVL := -O1 +$(B_DIR)/lib/libc/llcvt.o: OPT_LVL := -O1 +$(B_DIR)/lib/ultra/io/vigetnextframebuf.o: OPT_LVL := -O1 CFLAGS = -DVERSION=$(VERSION) \ -DNTSC=$(NTSC) \ @@ -291,7 +296,7 @@ $(B_DIR)/files/G%Z: $(E_DIR)/files/G%Z # Lang $(B_DIR)/files/lang/L%.o: src/files/lang/$(ROMID)/%.c @mkdir -p $(B_DIR)/files/lang - $(IDOCC) -c $(CFLAGS) $< -o $@ -O2 + $(IDOCC) -c $(CFLAGS) $< -o $@ $(OPT_LVL) $(B_DIR)/files/L%.elf: $(B_DIR)/files/lang/L%.o TOOLCHAIN=$(TOOLCHAIN) tools/mksimpleelf $< $@ @@ -353,37 +358,37 @@ $(B_DIR)/copyright.o: $(B_DIR)/copyright.bin $(B_DIR)/boot/%.o: src/boot/%.c @mkdir -p $(dir $@) - /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ -O2 + /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ $(OPT_LVL) /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s $(B_DIR)/lib/libc/llcvt.o: src/lib/libc/llcvt.c @mkdir -p $(dir $@) - /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ -O1 + /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ $(OPT_LVL) /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s tools/patchmips3 $@ || rm $@ $(B_DIR)/lib/libc/ll.o: src/lib/libc/ll.c @mkdir -p $(dir $@) - $(IDOCC) -c $(CFLAGS) $< -o $@ -O1 + $(IDOCC) -c $(CFLAGS) $< -o $@ $(OPT_LVL) tools/patchmips3 $@ || rm $@ $(B_DIR)/lib/%.o: src/lib/%.c @mkdir -p $(dir $@) - /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ -O2 + /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ $(OPT_LVL) /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s $(B_DIR)/game/%.o: src/game/%.c @mkdir -p $(dir $@) - /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ -O2 + /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ $(OPT_LVL) /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s $(B_DIR)/%.o: src/%.c @mkdir -p $(dir $@) - $(IDOCC) -c $(CFLAGS) $< -o $@ -O2 + $(IDOCC) -c $(CFLAGS) $< -o $@ $(OPT_LVL) $(B_DIR)/%.o: src/%.s @mkdir -p $(dir $@) - $(IDOAS) $(CFLAGS) $< -o $@ -O2 + $(IDOAS) $(CFLAGS) $< -o $@ $(OPT_LVL) extract: ROMID=$(ROMID) tools/extract diff --git a/ld/libfiles.inc b/ld/libfiles.inc index 59bba94b3..40a50aea6 100644 --- a/ld/libfiles.inc +++ b/ld/libfiles.inc @@ -93,6 +93,7 @@ build/ROMID/lib/ultra/os/setintmask.o (section); \ build/ROMID/lib/ultra/os/recvmesg.o (section); \ build/ROMID/lib/lib_48830.o (section); \ + build/ROMID/lib/ultra/io/vigetnextframebuf.o (section); \ build/ROMID/lib/ultra/io/dpsetstat.o (section); \ build/ROMID/lib/ultra/os/getthreadpri.o (section); \ build/ROMID/lib/ultra/os/sendmesg.o (section); \ diff --git a/src/game/data/data_003dc0.c b/src/game/data/data_003dc0.c index 869f77907..3ab443078 100644 --- a/src/game/data/data_003dc0.c +++ b/src/game/data/data_003dc0.c @@ -2290,20 +2290,9 @@ u32 var800608d0 = 0x00000000; u32 var800608d4 = 0x00000000; u32 var800608d8 = 0x00000000; u32 var800608dc = 0x00000000; -u32 var800608e0 = 0x00000000; -u32 var800608e4 = 0x00000000; -u32 var800608e8 = 0x00000000; -u32 var800608ec = 0x00000000; -u32 var800608f0 = 0x00000000; -u32 var800608f4 = 0x00000000; -u32 var800608f8 = 0x00000000; -u32 var800608fc = 0x00000000; -u32 var80060900 = 0x00000000; -u32 var80060904 = 0x00000000; -u32 var80060908 = 0x00000000; -u32 var8006090c = 0x00000000; +__OSViContext var800608e0 = {0}; u32 var80060910 = (u32) &var800608b0; -u32 var80060914 = (u32) &var800608e0; +__OSViContext *__osViNext = &var800608e0; u32 var80060918 = 0x00000000; u32 var8006091c = 0x00000000; u32 __osPiAccessQueueEnabled = 0x00000000; diff --git a/src/include/PR/os_vi.h b/src/include/PR/os_vi.h index 58944e650..b4e627a78 100644 --- a/src/include/PR/os_vi.h +++ b/src/include/PR/os_vi.h @@ -139,6 +139,26 @@ typedef struct /* 0x2c */ u32 unk2c; } OSViContext; +typedef struct +{ + /* 0x0 */ f32 factor; + /* 0x4 */ u16 offset; + /* 0x8 */ u32 scale; +} __OSViScale; + +typedef struct +{ + /* 0x0 */ u16 state; + /* 0x2 */ u16 retraceCount; + /* 0x4 */ void *framep; + /* 0x8 */ OSViMode *modep; + /* 0xC */ u32 control; + /* 0x10 */ OSMesgQueue *msgq; + /* 0x14 */ OSMesg msg; + /* 0x18 */ __OSViScale x; + /* 0x24 */ __OSViScale y; +} __OSViContext; + void osCreateViManager(OSPri pri); void osViSetMode(OSViMode *mode); void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount); diff --git a/src/include/game/data/data_000000.h b/src/include/game/data/data_000000.h index 099cf2c65..70d35dd70 100644 --- a/src/include/game/data/data_000000.h +++ b/src/include/game/data/data_000000.h @@ -180,7 +180,7 @@ extern u32 var80060340; extern u32 var80060368; extern u32 var800608b0; extern u32 var80060910; -extern u32 var80060914; +extern __OSViContext *__osViNext; extern u32 __osThreadTail; extern u32 __osRunQueue; extern u32 __osActiveQueue; diff --git a/src/lib/lib_485e0.c b/src/lib/lib_485e0.c index 59fa94359..ed39678de 100644 --- a/src/lib/lib_485e0.c +++ b/src/lib/lib_485e0.c @@ -19,18 +19,18 @@ glabel osViSetEvent /* 485f0: afa60030 */ sw $a2,0x30($sp) /* 485f4: 0c01256c */ jal __osDisableInt /* 485f8: afb00018 */ sw $s0,0x18($sp) -/* 485fc: 3c0f8006 */ lui $t7,%hi(var80060914) -/* 48600: 8def0914 */ lw $t7,%lo(var80060914)($t7) +/* 485fc: 3c0f8006 */ lui $t7,%hi(__osViNext) +/* 48600: 8def0914 */ lw $t7,%lo(__osViNext)($t7) /* 48604: 8fae0028 */ lw $t6,0x28($sp) -/* 48608: 3c198006 */ lui $t9,%hi(var80060914) -/* 4860c: 3c098006 */ lui $t1,%hi(var80060914) +/* 48608: 3c198006 */ lui $t9,%hi(__osViNext) +/* 4860c: 3c098006 */ lui $t1,%hi(__osViNext) /* 48610: adee0010 */ sw $t6,0x10($t7) -/* 48614: 8f390914 */ lw $t9,%lo(var80060914)($t9) +/* 48614: 8f390914 */ lw $t9,%lo(__osViNext)($t9) /* 48618: 8fb8002c */ lw $t8,0x2c($sp) /* 4861c: 00408025 */ or $s0,$v0,$zero /* 48620: 02002025 */ or $a0,$s0,$zero /* 48624: af380014 */ sw $t8,0x14($t9) -/* 48628: 8d290914 */ lw $t1,%lo(var80060914)($t1) +/* 48628: 8d290914 */ lw $t1,%lo(__osViNext)($t1) /* 4862c: 8fa80030 */ lw $t0,0x30($sp) /* 48630: 0c012588 */ jal __osRestoreInt /* 48634: a5280002 */ sh $t0,0x2($t1) diff --git a/src/lib/lib_48830.c b/src/lib/lib_48830.c index 97033171e..583da30ad 100644 --- a/src/lib/lib_48830.c +++ b/src/lib/lib_48830.c @@ -29,23 +29,3 @@ glabel osViGetCurrentFramebuffer /* 48868: 03e00008 */ jr $ra /* 4886c: 27bd0028 */ addiu $sp,$sp,0x28 ); - -GLOBAL_ASM( -glabel osViGetNextFramebuffer -/* 48870: 27bdffd8 */ addiu $sp,$sp,-40 -/* 48874: afbf001c */ sw $ra,0x1c($sp) -/* 48878: 0c01256c */ jal __osDisableInt -/* 4887c: afb00018 */ sw $s0,0x18($sp) -/* 48880: 3c0e8006 */ lui $t6,%hi(var80060914) -/* 48884: 8dce0914 */ lw $t6,%lo(var80060914)($t6) -/* 48888: 00408025 */ or $s0,$v0,$zero -/* 4888c: 02002025 */ or $a0,$s0,$zero -/* 48890: 8dcf0004 */ lw $t7,0x4($t6) -/* 48894: 0c012588 */ jal __osRestoreInt -/* 48898: afaf0020 */ sw $t7,0x20($sp) -/* 4889c: 8fbf001c */ lw $ra,0x1c($sp) -/* 488a0: 8fa20020 */ lw $v0,0x20($sp) -/* 488a4: 8fb00018 */ lw $s0,0x18($sp) -/* 488a8: 03e00008 */ jr $ra -/* 488ac: 27bd0028 */ addiu $sp,$sp,0x28 -); diff --git a/src/lib/lib_48cd0.c b/src/lib/lib_48cd0.c index 0fd359d74..ce9ce2e40 100644 --- a/src/lib/lib_48cd0.c +++ b/src/lib/lib_48cd0.c @@ -29,15 +29,15 @@ glabel func00048ce0 /* 48cf8: 00408025 */ or $s0,$v0,$zero /* 48cfc: 11c00007 */ beqz $t6,.L00048d1c /* 48d00: 00000000 */ nop -/* 48d04: 3c0f8006 */ lui $t7,%hi(var80060914) -/* 48d08: 8def0914 */ lw $t7,%lo(var80060914)($t7) +/* 48d04: 3c0f8006 */ lui $t7,%hi(__osViNext) +/* 48d08: 8def0914 */ lw $t7,%lo(__osViNext)($t7) /* 48d0c: 95f80000 */ lhu $t8,0x0($t7) /* 48d10: 37190020 */ ori $t9,$t8,0x20 /* 48d14: 10000007 */ b .L00048d34 /* 48d18: a5f90000 */ sh $t9,0x0($t7) .L00048d1c: -/* 48d1c: 3c088006 */ lui $t0,%hi(var80060914) -/* 48d20: 8d080914 */ lw $t0,%lo(var80060914)($t0) +/* 48d1c: 3c088006 */ lui $t0,%hi(__osViNext) +/* 48d20: 8d080914 */ lw $t0,%lo(__osViNext)($t0) /* 48d24: 2401ffdf */ addiu $at,$zero,-33 /* 48d28: 95090000 */ lhu $t1,0x0($t0) /* 48d2c: 01215024 */ and $t2,$t1,$at @@ -59,17 +59,17 @@ glabel func00048d50 /* 48d58: afa40028 */ sw $a0,0x28($sp) /* 48d5c: 0c01256c */ jal __osDisableInt /* 48d60: afb00018 */ sw $s0,0x18($sp) -/* 48d64: 3c0f8006 */ lui $t7,%hi(var80060914) -/* 48d68: 8def0914 */ lw $t7,%lo(var80060914)($t7) +/* 48d64: 3c0f8006 */ lui $t7,%hi(__osViNext) +/* 48d68: 8def0914 */ lw $t7,%lo(__osViNext)($t7) /* 48d6c: 8fae0028 */ lw $t6,0x28($sp) -/* 48d70: 3c198006 */ lui $t9,%hi(var80060914) +/* 48d70: 3c198006 */ lui $t9,%hi(__osViNext) /* 48d74: 24180001 */ addiu $t8,$zero,0x1 /* 48d78: adee0008 */ sw $t6,0x8($t7) -/* 48d7c: 8f390914 */ lw $t9,%lo(var80060914)($t9) -/* 48d80: 3c088006 */ lui $t0,%hi(var80060914) +/* 48d7c: 8f390914 */ lw $t9,%lo(__osViNext)($t9) +/* 48d80: 3c088006 */ lui $t0,%hi(__osViNext) /* 48d84: 00408025 */ or $s0,$v0,$zero /* 48d88: a7380000 */ sh $t8,0x0($t9) -/* 48d8c: 8d080914 */ lw $t0,%lo(var80060914)($t0) +/* 48d8c: 8d080914 */ lw $t0,%lo(__osViNext)($t0) /* 48d90: 02002025 */ or $a0,$s0,$zero /* 48d94: 8d090008 */ lw $t1,0x8($t0) /* 48d98: 8d2a0004 */ lw $t2,0x4($t1) diff --git a/src/lib/lib_48dc0.c b/src/lib/lib_48dc0.c index 9e48699f8..458874736 100644 --- a/src/lib/lib_48dc0.c +++ b/src/lib/lib_48dc0.c @@ -18,18 +18,18 @@ glabel func00048dc0 /* 48dcc: afb10018 */ sw $s1,0x18($sp) /* 48dd0: 0c01256c */ jal __osDisableInt /* 48dd4: afb00014 */ sw $s0,0x14($sp) -/* 48dd8: 3c0e8006 */ lui $t6,%hi(var80060914) -/* 48ddc: 8dce0914 */ lw $t6,%lo(var80060914)($t6) +/* 48dd8: 3c0e8006 */ lui $t6,%hi(__osViNext) +/* 48ddc: 8dce0914 */ lw $t6,%lo(__osViNext)($t6) /* 48de0: c7a40028 */ lwc1 $f4,0x28($sp) -/* 48de4: 3c0f8006 */ lui $t7,%hi(var80060914) -/* 48de8: 3c088006 */ lui $t0,%hi(var80060914) +/* 48de4: 3c0f8006 */ lui $t7,%hi(__osViNext) +/* 48de8: 3c088006 */ lui $t0,%hi(__osViNext) /* 48dec: e5c40018 */ swc1 $f4,0x18($t6) -/* 48df0: 8def0914 */ lw $t7,%lo(var80060914)($t7) +/* 48df0: 8def0914 */ lw $t7,%lo(__osViNext)($t7) /* 48df4: 00408825 */ or $s1,$v0,$zero /* 48df8: 95f80000 */ lhu $t8,0x0($t7) /* 48dfc: 37190002 */ ori $t9,$t8,0x2 /* 48e00: a5f90000 */ sh $t9,0x0($t7) -/* 48e04: 8d080914 */ lw $t0,%lo(var80060914)($t0) +/* 48e04: 8d080914 */ lw $t0,%lo(__osViNext)($t0) /* 48e08: 8d090008 */ lw $t1,0x8($t0) /* 48e0c: c5060018 */ lwc1 $f6,0x18($t0) /* 48e10: 8d300020 */ lw $s0,0x20($t1) diff --git a/src/lib/lib_48ef0.c b/src/lib/lib_48ef0.c index a4bf39a86..a43b743e1 100644 --- a/src/lib/lib_48ef0.c +++ b/src/lib/lib_48ef0.c @@ -17,13 +17,13 @@ glabel func00048ef0 /* 48ef8: e7ac0028 */ swc1 $f12,0x28($sp) /* 48efc: 0c01256c */ jal __osDisableInt /* 48f00: afb00018 */ sw $s0,0x18($sp) -/* 48f04: 3c0e8006 */ lui $t6,%hi(var80060914) -/* 48f08: 8dce0914 */ lw $t6,%lo(var80060914)($t6) +/* 48f04: 3c0e8006 */ lui $t6,%hi(__osViNext) +/* 48f08: 8dce0914 */ lw $t6,%lo(__osViNext)($t6) /* 48f0c: c7a40028 */ lwc1 $f4,0x28($sp) -/* 48f10: 3c0f8006 */ lui $t7,%hi(var80060914) +/* 48f10: 3c0f8006 */ lui $t7,%hi(__osViNext) /* 48f14: 00408025 */ or $s0,$v0,$zero /* 48f18: e5c40024 */ swc1 $f4,0x24($t6) -/* 48f1c: 8def0914 */ lw $t7,%lo(var80060914)($t7) +/* 48f1c: 8def0914 */ lw $t7,%lo(__osViNext)($t7) /* 48f20: 02002025 */ or $a0,$s0,$zero /* 48f24: 95f80000 */ lhu $t8,0x0($t7) /* 48f28: 37190004 */ ori $t9,$t8,0x4 diff --git a/src/lib/lib_48f50.c b/src/lib/lib_48f50.c index bc1cf0ca7..3a4205454 100644 --- a/src/lib/lib_48f50.c +++ b/src/lib/lib_48f50.c @@ -18,19 +18,19 @@ glabel func00048f50 /* 48f5c: afa40018 */ sw $a0,0x18($sp) /* 48f60: 8fa40018 */ lw $a0,0x18($sp) /* 48f64: 00402825 */ or $a1,$v0,$zero -/* 48f68: 3c038006 */ lui $v1,%hi(var80060914) +/* 48f68: 3c038006 */ lui $v1,%hi(__osViNext) /* 48f6c: 308e0001 */ andi $t6,$a0,0x1 /* 48f70: 11c00006 */ beqz $t6,.L00048f8c /* 48f74: 30990002 */ andi $t9,$a0,0x2 -/* 48f78: 24630914 */ addiu $v1,$v1,%lo(var80060914) +/* 48f78: 24630914 */ addiu $v1,$v1,%lo(__osViNext) /* 48f7c: 8c620000 */ lw $v0,0x0($v1) /* 48f80: 8c4f000c */ lw $t7,0xc($v0) /* 48f84: 35f80008 */ ori $t8,$t7,0x8 /* 48f88: ac58000c */ sw $t8,0xc($v0) .L00048f8c: -/* 48f8c: 3c038006 */ lui $v1,%hi(var80060914) +/* 48f8c: 3c038006 */ lui $v1,%hi(__osViNext) /* 48f90: 13200006 */ beqz $t9,.L00048fac -/* 48f94: 24630914 */ addiu $v1,$v1,%lo(var80060914) +/* 48f94: 24630914 */ addiu $v1,$v1,%lo(__osViNext) /* 48f98: 8c620000 */ lw $v0,0x0($v1) /* 48f9c: 2401fff7 */ addiu $at,$zero,-9 /* 48fa0: 8c48000c */ lw $t0,0xc($v0) diff --git a/src/lib/lib_490b0.c b/src/lib/lib_490b0.c index 2ef6ea01e..c6069c30a 100644 --- a/src/lib/lib_490b0.c +++ b/src/lib/lib_490b0.c @@ -17,13 +17,13 @@ glabel func000490b0 /* 490b4: afbf0014 */ sw $ra,0x14($sp) /* 490b8: 0c01256c */ jal __osDisableInt /* 490bc: afa40020 */ sw $a0,0x20($sp) -/* 490c0: 3c0f8006 */ lui $t7,%hi(var80060914) -/* 490c4: 8def0914 */ lw $t7,%lo(var80060914)($t7) +/* 490c0: 3c0f8006 */ lui $t7,%hi(__osViNext) +/* 490c4: 8def0914 */ lw $t7,%lo(__osViNext)($t7) /* 490c8: 8fae0020 */ lw $t6,0x20($sp) /* 490cc: afa2001c */ sw $v0,0x1c($sp) -/* 490d0: 3c188006 */ lui $t8,%hi(var80060914) +/* 490d0: 3c188006 */ lui $t8,%hi(__osViNext) /* 490d4: adee0004 */ sw $t6,0x4($t7) -/* 490d8: 8f180914 */ lw $t8,%lo(var80060914)($t8) +/* 490d8: 8f180914 */ lw $t8,%lo(__osViNext)($t8) /* 490dc: 97190000 */ lhu $t9,0x0($t8) /* 490e0: 37280010 */ ori $t0,$t9,0x10 /* 490e4: a7080000 */ sh $t0,0x0($t8) diff --git a/src/lib/ultra/io/vi.c b/src/lib/ultra/io/vi.c index 5935f6908..35c09234e 100644 --- a/src/lib/ultra/io/vi.c +++ b/src/lib/ultra/io/vi.c @@ -12,17 +12,17 @@ glabel __osViInit /* 4965c: 25ce08b0 */ addiu $t6,$t6,%lo(var800608b0) /* 49660: 3c018006 */ lui $at,%hi(var80060910) /* 49664: ac2e0910 */ sw $t6,%lo(var80060910)($at) -/* 49668: 3c018006 */ lui $at,%hi(var80060914) +/* 49668: 3c018006 */ lui $at,%hi(__osViNext) /* 4966c: 25cf0030 */ addiu $t7,$t6,0x30 -/* 49670: ac2f0914 */ sw $t7,%lo(var80060914)($at) +/* 49670: ac2f0914 */ sw $t7,%lo(__osViNext)($at) /* 49674: 24180001 */ addiu $t8,$zero,0x1 /* 49678: a5d80032 */ sh $t8,0x32($t6) /* 4967c: 3c088006 */ lui $t0,%hi(var80060910) /* 49680: 8d080910 */ lw $t0,%lo(var80060910)($t0) /* 49684: 24190001 */ addiu $t9,$zero,0x1 -/* 49688: 3c0a8006 */ lui $t2,%hi(var80060914) +/* 49688: 3c0a8006 */ lui $t2,%hi(__osViNext) /* 4968c: a5190002 */ sh $t9,0x2($t0) -/* 49690: 8d4a0914 */ lw $t2,%lo(var80060914)($t2) +/* 49690: 8d4a0914 */ lw $t2,%lo(__osViNext)($t2) /* 49694: 3c098000 */ lui $t1,0x8000 /* 49698: 3c0c8006 */ lui $t4,%hi(var80060910) /* 4969c: ad490004 */ sw $t1,0x4($t2) @@ -33,8 +33,8 @@ glabel __osViInit /* 496b0: 8dad0300 */ lw $t5,0x300($t5) /* 496b4: 15a00007 */ bnez $t5,.L000496d4 /* 496b8: 00000000 */ nop -/* 496bc: 3c188006 */ lui $t8,%hi(var80060914) -/* 496c0: 8f180914 */ lw $t8,%lo(var80060914)($t8) +/* 496bc: 3c188006 */ lui $t8,%hi(__osViNext) +/* 496c0: 8f180914 */ lw $t8,%lo(__osViNext)($t8) /* 496c4: 3c0f8006 */ lui $t7,%hi(var80061240) /* 496c8: 25ef1240 */ addiu $t7,$t7,%lo(var80061240) /* 496cc: 10000011 */ b .L00049714 @@ -45,25 +45,25 @@ glabel __osViInit /* 496dc: 24010002 */ addiu $at,$zero,0x2 /* 496e0: 15c10007 */ bne $t6,$at,.L00049700 /* 496e4: 00000000 */ nop -/* 496e8: 3c088006 */ lui $t0,%hi(var80060914) -/* 496ec: 8d080914 */ lw $t0,%lo(var80060914)($t0) +/* 496e8: 3c088006 */ lui $t0,%hi(__osViNext) +/* 496ec: 8d080914 */ lw $t0,%lo(__osViNext)($t0) /* 496f0: 3c198006 */ lui $t9,%hi(var80061290) /* 496f4: 27391290 */ addiu $t9,$t9,%lo(var80061290) /* 496f8: 10000006 */ b .L00049714 /* 496fc: ad190008 */ sw $t9,0x8($t0) .L00049700: -/* 49700: 3c0a8006 */ lui $t2,%hi(var80060914) -/* 49704: 8d4a0914 */ lw $t2,%lo(var80060914)($t2) +/* 49700: 3c0a8006 */ lui $t2,%hi(__osViNext) +/* 49704: 8d4a0914 */ lw $t2,%lo(__osViNext)($t2) /* 49708: 3c098006 */ lui $t1,%hi(var800612e0) /* 4970c: 252912e0 */ addiu $t1,$t1,%lo(var800612e0) /* 49710: ad490008 */ sw $t1,0x8($t2) .L00049714: -/* 49714: 3c0c8006 */ lui $t4,%hi(var80060914) -/* 49718: 8d8c0914 */ lw $t4,%lo(var80060914)($t4) +/* 49714: 3c0c8006 */ lui $t4,%hi(__osViNext) +/* 49718: 8d8c0914 */ lw $t4,%lo(__osViNext)($t4) /* 4971c: 240b0020 */ addiu $t3,$zero,0x20 -/* 49720: 3c0d8006 */ lui $t5,%hi(var80060914) +/* 49720: 3c0d8006 */ lui $t5,%hi(__osViNext) /* 49724: a58b0000 */ sh $t3,0x0($t4) -/* 49728: 8dad0914 */ lw $t5,%lo(var80060914)($t5) +/* 49728: 8dad0914 */ lw $t5,%lo(__osViNext)($t5) /* 4972c: 3c0ea440 */ lui $t6,0xa440 /* 49730: 8daf0008 */ lw $t7,0x8($t5) /* 49734: 8df80004 */ lw $t8,0x4($t7) diff --git a/src/lib/ultra/io/vigetnextframebuf.c b/src/lib/ultra/io/vigetnextframebuf.c new file mode 100644 index 000000000..3c67e3bd3 --- /dev/null +++ b/src/lib/ultra/io/vigetnextframebuf.c @@ -0,0 +1,16 @@ +#include +#include "game/data/data_000000.h" + +void *osViGetNextFramebuffer(void) +{ + register u32 saveMask; + void *framep; + + saveMask = __osDisableInt(); + + framep = __osViNext->framep; + + __osRestoreInt(saveMask); + + return framep; +} diff --git a/src/lib/ultra/io/viswapcontext.c b/src/lib/ultra/io/viswapcontext.c index 110f93974..85798697c 100644 --- a/src/lib/ultra/io/viswapcontext.c +++ b/src/lib/ultra/io/viswapcontext.c @@ -5,9 +5,9 @@ glabel __osViSwapContext /* 49790: 27bdffb8 */ addiu $sp,$sp,-72 /* 49794: afb00018 */ sw $s0,0x18($sp) /* 49798: afbf001c */ sw $ra,0x1c($sp) -/* 4979c: 3c108006 */ lui $s0,%hi(var80060914) +/* 4979c: 3c108006 */ lui $s0,%hi(__osViNext) /* 497a0: 3c0ea440 */ lui $t6,0xa440 -/* 497a4: 8e100914 */ lw $s0,%lo(var80060914)($s0) +/* 497a4: 8e100914 */ lw $s0,%lo(__osViNext)($s0) /* 497a8: 8dcf0010 */ lw $t7,0x10($t6) /* 497ac: 8e050008 */ lw $a1,0x8($s0) /* 497b0: 31f80001 */ andi $t8,$t7,0x1 @@ -171,10 +171,10 @@ glabel __osViSwapContext /* 499fc: af070024 */ sw $a3,0x24($t8) /* 49a00: 8fb90034 */ lw $t9,0x34($sp) /* 49a04: 3c0ea440 */ lui $t6,0xa440 -/* 49a08: 3c038006 */ lui $v1,%hi(var80060914) +/* 49a08: 3c038006 */ lui $v1,%hi(__osViNext) /* 49a0c: ad190028 */ sw $t9,0x28($t0) /* 49a10: 8cc90034 */ lw $t1,0x34($a2) -/* 49a14: 24630914 */ addiu $v1,$v1,%lo(var80060914) +/* 49a14: 24630914 */ addiu $v1,$v1,%lo(__osViNext) /* 49a18: ad49002c */ sw $t1,0x2c($t2) /* 49a1c: 8ccb0038 */ lw $t3,0x38($a2) /* 49a20: adab000c */ sw $t3,0xc($t5)