Overhaul the build system (#234)

* wip

* fix

* add disassembler

* Disasm builds OK

* Variable addends

* More wip

* Rodata migration implemented

* Cleanup old tools

* Try fix submodule -> subrepo merge

* git subrepo pull --force --remote=https://github.com/zeldaret/ZAPD.git tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "602e609"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "602e609"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* Builds again but assets are totally broken

* git subrepo pull --force tools/asm-processor

subrepo:
  subdir:   "tools/asm-processor"
  merged:   "1ffdb08a"
upstream:
  origin:   "https://github.com/simonlindholm/asm-processor.git"
  branch:   "master"
  commit:   "1ffdb08a"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* More cleanup, move functions.txt and variables.txt to tools/disasm and rm tables

* rm z64compress in preparation for subrepo

* git subrepo clone (merge) https://github.com/z64me/z64compress.git tools/z64compress

subrepo:
  subdir:   "tools/z64compress"
  merged:   "eb11085c"
upstream:
  origin:   "https://github.com/z64me/z64compress.git"
  branch:   "main"
  commit:   "eb11085c"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* Fix asset extraction

* Fix diff-init make rule

* Split code bss

* Split assumed linker bug padding from assembly files

* add filelists for mm.us.rev1

* Maybe working, but I'm not sure

* add overlays to spec

* Add rodata to actos

* Everything compiles

* Make a lot of C files for code

* Add almost every file in code to spec

* whoops

* 3 code files left

* add scenes to spec

* More progress on progress.py

* Fix skelanime in spec

* audio files!

* Fix merge issues

* Fix some C files in code

* Fix remaining code files

* Use existing O1 C files in spec

* reorder boot order in spec

* update spec

* fault.c

* Convert relocs on completed actors, fixbaserom uses current rom name

* more boot files

* Add VT macros and script

* finish already existing boot files

* most of  libultra

* fix 64bits libultra files

* Use C files for libultra, wrap some functions in NON_MATCHING

* Remove duplicate of OS_CLOCK_RATE from fault.c

* C files for fbdemos

* delete dumb files

* bootstrap C files, still need to add them to the spec

* update fixbaserom

* boot OK?

* I forgot to commit the spec

* C for gamestates

* C for kaleido

* Change all includes to ""

* copy actor sizes script from oot

* I forgot to delete those files

* Basic C files for effects

* Add effects initvars names

* Remove mislabelled boot functions from header/txt

* Begin porting bootstrap_fx, some sizes

* Fix <>

* Fix enum

* Fix diff.py

* fix libultra stuff

* update regconvert

* update setup warnings

* add some missing ;

* Fix some makefile stuff and other fixes on some non_matching functions

* add executable flag in extract_baserom and fixbaserom

* fix relative path

* copy assist from oot

* fix map path

* another assist path fix

* Delete C files for handwritten files

* add code_801A51F0 to spec

* add gfxbuffers to spec

* Move rodata to top of each file when possible

* UNK_TYPEs for func_801A51F0

* Remove kaleido rodata from spec

* Update spec and undefined_syms for recent merge

* GCC warnings and fix errors in nonmatchings,

* round percentage numbers

* progress script: format changes

* progress: error on non-existing files

* fix warning in z_scene_table

* Match 2 nonmatchings in z_actor

* Warnings in lightswitch and invadepoh

* Fix warning in z_actor_dlftbls

* I though I fixed this one

* whoops

* Comment out CC_CHECK

* Removed redundant ultra64.h includes

* Update asm_processor, sorted boot_O1 into other folders, completed the fbdemo bootstrap, cleaned up undefined_syms

* Completed gamestates bootstrap

* Split kaleido_scope

* Remove section.h and segment.h, move keep object externs to a common location in variables.h

* Completed effects bootstrap

* Segmented address externs for effects, fbdemos, gamestates and kaleido

* Move actor data externs out of the if 0

* Segmented address externs for actors

* Prepare actionfunc detection

* fix script, how did it even work before

* Fix actionfunc script again, re-introduce some more intermediate prints to the disassembler

* Automated actionFunc detection in actors

* Segmented addresses from player .text

* rm old segment addrs script and fix build

* Move sizes folder to tools

* Make build.py executable

* New Jenkinsfile Prayge

* Remove numpy dependencies

* Add warnings_disasm_current.txt

* my bad

* Update spec and undefined_syms

* Add z_eff_ss_hahen to pametfrog

* git subrepo pull (merge) --force tools/z64compress

subrepo:
  subdir:   "tools/z64compress"
  merged:   "163ca2af"
upstream:
  origin:   "https://github.com/z64me/z64compress.git"
  branch:   "main"
  commit:   "163ca2af"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* Make z64compress print to stdout

* sneeky commit to update warnings tooling

* test

* Another test

* Mark fixing overlay reloc generating as a TODO

* Update warnings stuff

* Communicate the return code from running z64compress back to the Makefile through the wrapper

* Run formatter, remove extra commented copy of function

* Re-fix some includes

* Convert atan to hex to conform to decided style

* Some tidying up, remove c for fp and the other two handwritten code files

* BSS in z_collision_check & z_scene_proc

* add static back in

* Fix timerintr bss, add file to spec, some cleanup

* Remove externs

* Newline

* Readd enums

* Typo

* Colours

* Comments for hitmark enum values

Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>

* Improvements and suggestions

* Organize and remove unused imports and use env for python3 scripts, delete unused overlay.py

Co-authored-by: angie <angheloalf95@gmail.com>
Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com>
Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
This commit is contained in:
Tharo
2021-08-04 04:21:31 +01:00
committed by GitHub
parent 60ff207982
commit 7743e5a2c4
1788 changed files with 88892 additions and 47119 deletions
+1 -2
View File
@@ -1,5 +1,4 @@
#include <ultra64.h>
#include <global.h>
#include "global.h"
void CIC6105_Nop80081820(void) {
}
@@ -1,10 +1,9 @@
#include <ultra64.h>
#include <global.h>
#include "global.h"
/*
* Compare strings (strcmp).
*/
s32 func_800968B0(const char* str1, const char* str2) {
s32 __osMemcmp(const char* str1, const char* str2) {
char currentCharStr1;
char currentCharStr2;
do {
-11
View File
@@ -1,11 +0,0 @@
#include <ultra64.h>
#include <global.h>
// This file contains print functions that are used by fault.c, so they are placed in the fault module
void Fault_Nop80081920(UNK_TYPE4 param_1, ...) {
}
void Fault_Log(char* str, ...) {
}
void Fault_Nop80081958(UNK_TYPE4 param_1, ...) {
}
+1 -2
View File
@@ -1,5 +1,4 @@
#include <ultra64.h>
#include <global.h>
#include "global.h"
void bootproc(void) {
StackCheck_Init(&sBootThreadInfo, sBootThreadStack, sBootThreadStack + sizeof(sBootThreadStack), 0, -1, "boot");
+894
View File
@@ -0,0 +1,894 @@
#include "global.h"
#include "vt.h"
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault/D_800982B0.s")
void Fault_SleepImpl(u32 duration) {
u64 value = (duration * OS_CPU_COUNTER) / 1000ull;
Sleep_Cycles(value);
}
void Fault_AddClient(FaultClient* client, fault_client_func callback, void* param0, void* param1) {
OSIntMask mask;
u32 alreadyExists = 0;
mask = osSetIntMask(1);
{
FaultClient* iter = sFaultContext->clients;
while (iter) {
if (iter == client) {
alreadyExists = 1;
goto end;
}
iter = iter->next;
}
}
client->callback = callback;
client->param0 = param0;
client->param1 = param1;
client->next = sFaultContext->clients;
sFaultContext->clients = client;
end:
osSetIntMask(mask);
if (alreadyExists) {
osSyncPrintf(VT_COL(RED, WHITE) "fault_AddClient: %08x は既にリスト中にある\n" VT_RST, client);
}
}
void Fault_RemoveClient(FaultClient* client) {
FaultClient* iter;
FaultClient* lastIter;
OSIntMask mask;
u32 listIsEmpty;
iter = sFaultContext->clients;
listIsEmpty = 0;
lastIter = NULL;
mask = osSetIntMask(1);
while (iter) {
if (iter == client) {
if (lastIter) {
lastIter->next = client->next;
} else {
sFaultContext->clients = client;
if (sFaultContext->clients) {
sFaultContext->clients = client->next;
} else {
listIsEmpty = 1;
}
}
break;
}
lastIter = iter;
iter = iter->next;
}
osSetIntMask(mask);
if (listIsEmpty) {
osSyncPrintf(VT_COL(RED, WHITE) "fault_RemoveClient: %08x リスト不整合です\n" VT_RST, client);
}
}
void Fault_AddAddrConvClient(FaultAddrConvClient* client, fault_address_converter_func callback, void* param) {
OSIntMask mask;
u32 alreadyExists = 0;
mask = osSetIntMask(1);
{
FaultAddrConvClient* iter = sFaultContext->addrConvClients;
while (iter) {
if (iter == client) {
alreadyExists = 1;
goto end;
}
iter = iter->next;
}
}
client->callback = callback;
client->param = param;
client->next = sFaultContext->addrConvClients;
sFaultContext->addrConvClients = client;
end:
osSetIntMask(mask);
if (alreadyExists) {
osSyncPrintf(VT_COL(RED, WHITE) "fault_AddressConverterAddClient: %08x は既にリスト中にある\n" VT_RST, client);
}
}
void Fault_RemoveAddrConvClient(FaultAddrConvClient* client) {
FaultAddrConvClient* iter;
FaultAddrConvClient* lastIter;
OSIntMask mask;
u32 listIsEmpty;
iter = sFaultContext->addrConvClients;
listIsEmpty = 0;
lastIter = NULL;
mask = osSetIntMask(1);
while (iter) {
if (iter == client) {
if (lastIter) {
lastIter->next = client->next;
} else {
sFaultContext->addrConvClients = client;
if (sFaultContext->addrConvClients) {
sFaultContext->addrConvClients = client->next;
} else {
listIsEmpty = 1;
}
}
break;
}
lastIter = iter;
iter = iter->next;
}
osSetIntMask(mask);
if (listIsEmpty) {
osSyncPrintf(VT_COL(RED, WHITE) "fault_AddressConverterRemoveClient: %08x は既にリスト中にある\n" VT_RST,
client);
}
}
void* Fault_ConvertAddress(void* addr) {
void* ret;
FaultAddrConvClient* iter = sFaultContext->addrConvClients;
while (iter) {
if (iter->callback) {
ret = iter->callback(addr, iter->param);
if (ret != NULL) {
return ret;
}
}
iter = iter->next;
}
return NULL;
}
void Fault_Sleep(u32 duration) {
Fault_SleepImpl(duration);
}
void Fault_PadCallback(Input* input) {
Padmgr_GetInput2(input, 0);
}
void Fault_UpdatePadImpl() {
sFaultContext->padCallback(sFaultContext->padInput);
}
u32 Fault_WaitForInputImpl() {
Input* curInput = &sFaultContext->padInput[0];
s32 count = 600;
u32 kDown;
while (1) {
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
kDown = curInput->press.button;
if (kDown == BTN_L) {
sFaultContext->faultActive = !sFaultContext->faultActive;
}
if (sFaultContext->faultActive) {
if (count-- < 1) {
return 0;
}
} else {
if (kDown == BTN_A || kDown == BTN_DRIGHT) {
return 0;
}
if (kDown == BTN_DLEFT) {
return 1;
}
if (kDown == BTN_DUP) {
FaultDrawer_SetOsSyncPrintfEnabled(1);
}
if (kDown == BTN_DDOWN) {
FaultDrawer_SetOsSyncPrintfEnabled(0);
}
}
}
}
void Fault_WaitForInput() {
Fault_WaitForInputImpl();
}
void Fault_DrawRec(s32 x, s32 y, s32 w, s32 h, u16 color) {
FaultDrawer_DrawRecImpl(x, y, x + w - 1, y + h - 1, color);
}
void Fault_FillScreenBlack() {
FaultDrawer_SetForeColor(0xFFFF);
FaultDrawer_SetBackColor(1);
FaultDrawer_FillScreen();
FaultDrawer_SetBackColor(0);
}
void Fault_FillScreenRed() {
FaultDrawer_SetForeColor(0xFFFF);
FaultDrawer_SetBackColor(0xF001);
FaultDrawer_FillScreen();
FaultDrawer_SetBackColor(0);
}
void Fault_DrawCornerRec(u16 color) {
Fault_DrawRec(0x16, 0x10, 8, 1, color);
}
void Fault_PrintFReg(s32 idx, f32* value) {
u32 raw = *(u32*)value;
s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f;
if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) {
FaultDrawer_Printf("F%02d:%14.7e ", idx, *value);
} else {
FaultDrawer_Printf("F%02d: %08x(16) ", idx, raw);
}
}
void osSyncPrintfFReg(s32 idx, f32* value) {
u32 raw = *(u32*)value;
s32 v0 = ((raw & 0x7F800000) >> 0x17) - 0x7F;
if ((v0 >= -0x7E && v0 < 0x80) || raw == 0) {
osSyncPrintf("F%02d:%14.7e ", idx, *value);
} else {
osSyncPrintf("F%02d: %08x(16) ", idx, *(u32*)value);
}
}
void Fault_PrintFPCR(u32 value) {
s32 i;
u32 flag = 0x20000;
FaultDrawer_Printf("FPCSR:%08xH ", value);
for (i = 0; i < ARRAY_COUNT(sExceptionNames); i++) {
if (value & flag) {
FaultDrawer_Printf("(%s)", sExceptionNames[i]);
break;
}
flag >>= 1;
}
FaultDrawer_Printf("\n");
}
void osSyncPrintfFPCR(u32 value) {
s32 i;
u32 flag = 0x20000;
osSyncPrintf("FPCSR:%08xH ", value);
for (i = 0; i < ARRAY_COUNT(sExceptionNames); i++) {
if (value & flag) {
osSyncPrintf("(%s)\n", sExceptionNames[i]);
break;
}
flag >>= 1;
}
}
void Fault_PrintThreadContext(OSThread* t) {
__OSThreadContext* ctx;
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
if (causeStrIdx == 0x17) {
causeStrIdx = 0x10;
}
if (causeStrIdx == 0x1F) {
causeStrIdx = 0x11;
}
FaultDrawer_FillScreen();
FaultDrawer_SetCharPad(-2, 4);
FaultDrawer_SetCursor(0x16, 0x14);
ctx = &t->context;
FaultDrawer_Printf("THREAD:%d (%d:%s)\n", t->id, causeStrIdx, D_80096B80[causeStrIdx]);
FaultDrawer_SetCharPad(-1, 0);
FaultDrawer_Printf("PC:%08xH SR:%08xH VA:%08xH\n", (u32)ctx->pc, (u32)ctx->sr, (u32)ctx->badvaddr);
FaultDrawer_Printf("AT:%08xH V0:%08xH V1:%08xH\n", (u32)ctx->at, (u32)ctx->v0, (u32)ctx->v1);
FaultDrawer_Printf("A0:%08xH A1:%08xH A2:%08xH\n", (u32)ctx->a0, (u32)ctx->a1, (u32)ctx->a2);
FaultDrawer_Printf("A3:%08xH T0:%08xH T1:%08xH\n", (u32)ctx->a3, (u32)ctx->t0, (u32)ctx->t1);
FaultDrawer_Printf("T2:%08xH T3:%08xH T4:%08xH\n", (u32)ctx->t2, (u32)ctx->t3, (u32)ctx->t4);
FaultDrawer_Printf("T5:%08xH T6:%08xH T7:%08xH\n", (u32)ctx->t5, (u32)ctx->t6, (u32)ctx->t7);
FaultDrawer_Printf("S0:%08xH S1:%08xH S2:%08xH\n", (u32)ctx->s0, (u32)ctx->s1, (u32)ctx->s2);
FaultDrawer_Printf("S3:%08xH S4:%08xH S5:%08xH\n", (u32)ctx->s3, (u32)ctx->s4, (u32)ctx->s5);
FaultDrawer_Printf("S6:%08xH S7:%08xH T8:%08xH\n", (u32)ctx->s6, (u32)ctx->s7, (u32)ctx->t8);
FaultDrawer_Printf("T9:%08xH GP:%08xH SP:%08xH\n", (u32)ctx->t9, (u32)ctx->gp, (u32)ctx->sp);
FaultDrawer_Printf("S8:%08xH RA:%08xH LO:%08xH\n\n", (u32)ctx->s8, (u32)ctx->ra, (u32)ctx->lo);
Fault_PrintFPCR(ctx->fpcsr);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0, &ctx->fp0.f.f_even);
Fault_PrintFReg(2, &ctx->fp2.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(4, &ctx->fp4.f.f_even);
Fault_PrintFReg(6, &ctx->fp6.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(8, &ctx->fp8.f.f_even);
Fault_PrintFReg(0xA, &ctx->fp10.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0xC, &ctx->fp12.f.f_even);
Fault_PrintFReg(0xE, &ctx->fp14.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x10, &ctx->fp16.f.f_even);
Fault_PrintFReg(0x12, &ctx->fp18.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x14, &ctx->fp20.f.f_even);
Fault_PrintFReg(0x16, &ctx->fp22.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x18, &ctx->fp24.f.f_even);
Fault_PrintFReg(0x1A, &ctx->fp26.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x1C, &ctx->fp28.f.f_even);
Fault_PrintFReg(0x1E, &ctx->fp30.f.f_even);
FaultDrawer_Printf("\n");
FaultDrawer_SetCharPad(0, 0);
if (D_8009BE54 != 0) {
FaultDrawer_DrawText(0xA0, 0xD8, "%5.2f sec\n", D_8009BE54);
}
}
void osSyncPrintfThreadContext(OSThread* t) {
__OSThreadContext* ctx;
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
if (causeStrIdx == 0x17) {
causeStrIdx = 0x10;
}
if (causeStrIdx == 0x1f) {
causeStrIdx = 0x11;
}
ctx = &t->context;
osSyncPrintf("\n");
osSyncPrintf("THREAD ID:%d (%d:%s)\n", t->id, causeStrIdx, D_80096B80[causeStrIdx]);
osSyncPrintf("PC:%08xH SR:%08xH VA:%08xH\n", (u32)ctx->pc, (u32)ctx->sr, (u32)ctx->badvaddr);
osSyncPrintf("AT:%08xH V0:%08xH V1:%08xH\n", (u32)ctx->at, (u32)ctx->v0, (u32)ctx->v1);
osSyncPrintf("A0:%08xH A1:%08xH A2:%08xH\n", (u32)ctx->a0, (u32)ctx->a1, (u32)ctx->a2);
osSyncPrintf("A3:%08xH T0:%08xH T1:%08xH\n", (u32)ctx->a3, (u32)ctx->t0, (u32)ctx->t1);
osSyncPrintf("T2:%08xH T3:%08xH T4:%08xH\n", (u32)ctx->t2, (u32)ctx->t3, (u32)ctx->t4);
osSyncPrintf("T5:%08xH T6:%08xH T7:%08xH\n", (u32)ctx->t5, (u32)ctx->t6, (u32)ctx->t7);
osSyncPrintf("S0:%08xH S1:%08xH S2:%08xH\n", (u32)ctx->s0, (u32)ctx->s1, (u32)ctx->s2);
osSyncPrintf("S3:%08xH S4:%08xH S5:%08xH\n", (u32)ctx->s3, (u32)ctx->s4, (u32)ctx->s5);
osSyncPrintf("S6:%08xH S7:%08xH T8:%08xH\n", (u32)ctx->s6, (u32)ctx->s7, (u32)ctx->t8);
osSyncPrintf("T9:%08xH GP:%08xH SP:%08xH\n", (u32)ctx->t9, (u32)ctx->gp, (u32)ctx->sp);
osSyncPrintf("S8:%08xH RA:%08xH LO:%08xH\n", (u32)ctx->s8, (u32)ctx->ra, (u32)ctx->lo);
osSyncPrintf("\n");
osSyncPrintfFPCR(ctx->fpcsr);
osSyncPrintf("\n");
osSyncPrintfFReg(0, &ctx->fp0.f.f_even);
osSyncPrintfFReg(2, &ctx->fp2.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(4, &ctx->fp4.f.f_even);
osSyncPrintfFReg(6, &ctx->fp6.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(8, &ctx->fp8.f.f_even);
osSyncPrintfFReg(0xa, &ctx->fp10.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(0xc, &ctx->fp12.f.f_even);
osSyncPrintfFReg(0xe, &ctx->fp14.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(0x10, &ctx->fp16.f.f_even);
osSyncPrintfFReg(0x12, &ctx->fp18.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(0x14, &ctx->fp20.f.f_even);
osSyncPrintfFReg(0x16, &ctx->fp22.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(0x18, &ctx->fp24.f.f_even);
osSyncPrintfFReg(0x1a, &ctx->fp26.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(0x1c, &ctx->fp28.f.f_even);
osSyncPrintfFReg(0x1e, &ctx->fp30.f.f_even);
osSyncPrintf("\n");
}
OSThread* Fault_FindFaultedThread() {
OSThread* iter = __osGetActiveQueue();
while (iter->priority != -1) {
if (iter->priority > 0 && iter->priority < 0x7f && (iter->flags & 3)) {
return iter;
}
iter = iter->tlnext;
}
return NULL;
}
void Fault_Wait5Seconds(void) {
u32 pad;
OSTime start;
start = osGetTime();
do {
Fault_Sleep(0x10);
} while ((osGetTime() - start) <= OS_USEC_TO_CYCLES(5000000));
sFaultContext->faultActive = 1;
}
void Fault_WaitForButtonCombo(void) {
Input* input = &sFaultContext->padInput[0];
FaultDrawer_SetForeColor(0xffff);
FaultDrawer_SetBackColor(1);
do {
do {
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
} while (!CHECK_BTN_ALL(input->press.button, 0x80));
} while (!CHECK_BTN_ALL(input->cur.button, BTN_DLEFT | BTN_L | BTN_R | BTN_CRIGHT));
}
void Fault_DrawMemDumpPage(char* title, u32* addr, u32 param_3) {
u32* alignedAddr;
u32* writeAddr;
s32 y;
s32 x;
alignedAddr = addr;
if (alignedAddr < (u32*)0x80000000) {
alignedAddr = (u32*)0x80000000;
}
if (alignedAddr > (u32*)0x807fff00) {
alignedAddr = (u32*)0x807fff00;
}
alignedAddr = (u32*)((u32)alignedAddr & ~3);
writeAddr = alignedAddr;
Fault_FillScreenBlack();
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_DrawText(0x24, 0x12, "%s %08x", title ? title : "PrintDump", alignedAddr);
if (alignedAddr >= (u32*)0x80000000 && alignedAddr < (u32*)0xC0000000) {
for (y = 0x1C; y != 0xE2; y += 9) {
FaultDrawer_DrawText(0x18, y, "%06x", writeAddr);
for (x = 0x52; x != 0x122; x += 0x34) {
FaultDrawer_DrawText(x, y, "%08x", *writeAddr++);
}
}
}
FaultDrawer_SetCharPad(0, 0);
}
void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
s32 count;
s32 off;
Input* input = &sFaultContext->padInput[0];
u32 addr = pc;
do {
count = 0;
if (addr < 0x80000000) {
addr = 0x80000000;
}
if (addr > 0x807fff00) {
addr = 0x807fff00;
}
addr &= ~0xF;
Fault_DrawMemDumpPage("Dump", (u32*)addr, 0);
count = 600;
while (sFaultContext->faultActive) {
if (count == 0) {
return;
}
count--;
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
if (CHECK_BTN_ALL(input->press.button, BTN_L)) {
sFaultContext->faultActive = 0;
}
}
do {
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
} while (input->press.button == 0);
if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
return;
}
off = 0x10;
if (CHECK_BTN_ALL(input->cur.button, BTN_A)) {
off = 0x100;
}
if (CHECK_BTN_ALL(input->cur.button, BTN_B)) {
off <<= 8;
}
if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
addr -= off;
}
if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
addr += off;
}
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
addr = pc;
}
if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
addr = sp;
}
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
addr = unk0;
}
if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
addr = unk1;
}
} while (!CHECK_BTN_ALL(input->press.button, BTN_L));
sFaultContext->faultActive = 1;
}
#ifdef NON_MATCHING
// This function still needs a bit of work
void Fault_FindNextStackCall(u32** sp, u32** pc, u32** ra) {
u32* currentSp;
u32* currentPc;
u32* currentRa;
u32 lastInst;
u32 currInst;
currentSp = *sp;
currentPc = *pc;
currentRa = *ra;
if ((((u32)currentSp & 3) != 0) || (currentSp < (u32*)0x80000000) || (currentSp >= (u32*)0xC0000000) ||
(((u32)currentRa & 3) != 0) || (currentRa < (u32*)0x80000000) || (currentRa >= (u32*)0xC0000000)) {
*sp = NULL;
*pc = NULL;
*ra = NULL;
return;
}
if ((((u32)currentPc & 3) != 0) || (currentPc < (u32*)0x80000000) || (currentPc >= (u32*)0xC0000000)) {
*pc = currentRa;
return;
}
lastInst = 0;
while (1) {
currInst = *currentPc;
if (((currInst >> 0x10) & 0xFFFF) == 0x8FBF) {
currentRa = *(u32**)((u32)currentSp + (s16)currInst);
} else if (((currInst >> 0x10) & 0xFFFF) == 0x27BD) {
currentSp = (u32*)((u32)currentSp + (s16)currInst);
} else if (currInst == 0x42000018) {
currentSp = NULL;
currentPc = NULL;
currentRa = NULL;
break;
}
if (lastInst == 0x03E00008) {
break;
}
if ((lastInst >> 0x1A) == 2) {
currentPc = (u32*)((((u32)currentPc >> 0x1C) << 0x1C) | ((lastInst << 6) >> 4));
break;
}
lastInst = currInst;
currentPc++;
}
*sp = currentSp;
*pc = currentPc;
*ra = currentRa;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault/Fault_FindNextStackCall.s")
#endif
void Fault_DrawStackTrace(OSThread* t, u32 flags) {
s32 y;
u32 sp;
u32 ra;
u32 pc;
u32 pad;
u32 convertedPc;
sp = t->context.sp;
ra = t->context.ra;
pc = t->context.pc;
Fault_FillScreenBlack();
FaultDrawer_DrawText(0x78, 0x10, "STACK TRACE");
FaultDrawer_DrawText(0x24, 0x18, "SP PC (VPC)");
for (y = 1; (y < 22) && (((ra != 0) || (sp != 0)) && (pc != (u32)__osCleanupThread)); y++) {
FaultDrawer_DrawText(0x24, y * 8 + 24, "%08x %08x", sp, pc);
if (flags & 1) {
convertedPc = (u32)Fault_ConvertAddress((void*)pc);
if (convertedPc != 0) {
FaultDrawer_Printf(" -> %08x", convertedPc);
}
} else {
FaultDrawer_Printf(" -> ????????");
}
Fault_FindNextStackCall((u32**)&sp, (u32**)&pc, (u32**)&ra);
}
}
void osSyncPrintfStackTrace(OSThread* t, u32 flags) {
s32 y;
u32 sp;
u32 ra;
u32 pc;
u32 convertedPc;
sp = t->context.sp;
ra = t->context.ra;
pc = t->context.pc;
osSyncPrintf("STACK TRACE");
osSyncPrintf("SP PC (VPC)\n");
for (y = 1; (y < 22) && (((ra != 0) || (sp != 0)) && (pc != (u32)__osCleanupThread)); y++) {
osSyncPrintf("%08x %08x", sp, pc);
if (flags & 1) {
convertedPc = (u32)Fault_ConvertAddress((void*)pc);
if (convertedPc != 0) {
osSyncPrintf(" -> %08x", convertedPc);
}
} else {
osSyncPrintf(" -> ????????");
}
osSyncPrintf("\n");
Fault_FindNextStackCall((u32**)&sp, (u32**)&pc, (u32**)&ra);
}
}
void Fault_ResumeThread(OSThread* t) {
t->context.cause = 0;
t->context.fpcsr = 0;
t->context.pc += 4;
*(u32*)t->context.pc = 0xd;
osWritebackDCache((void*)t->context.pc, 4);
osInvalICache((void*)t->context.pc, 4);
osStartThread(t);
}
void Fault_CommitFB() {
u16* fb;
osViSetYScale(1.0f);
osViSetMode(&osViModeNtscLan1);
osViSetSpecialFeatures(0x42); // gama_disable|dither_fliter_enable_aa_mode3_disable
osViBlack(0);
if (sFaultContext->fb) {
fb = sFaultContext->fb;
} else {
fb = (u16*)osViGetNextFramebuffer();
if ((u32)fb == 0x80000000) {
fb = (u16*)((osMemSize | 0x80000000) - 0x25800);
}
}
osViSwapBuffer(fb);
FaultDrawer_SetDrawerFB(fb, SCREEN_WIDTH, SCREEN_HEIGHT);
}
void Fault_ProcessClients(void) {
FaultClient* iter = sFaultContext->clients;
s32 idx = 0;
while (iter != NULL) {
if (iter->callback) {
Fault_FillScreenBlack();
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_Printf("8CallBack (%d) %08x %08x %08x\n7", idx++, iter, iter->param0, iter->param1);
FaultDrawer_SetCharPad(0, 0);
iter->callback(iter->param0, iter->param1);
Fault_WaitForInput();
Fault_CommitFB();
}
iter = iter->next;
}
}
#ifdef NON_MATCHING
// regalloc and ordering differences around the two bool variables (faultCustomOptions and faultCopyToLog)
void Fault_SetOptionsFromController3(void) {
Input* input3;
u32 pad;
u32 graphPC;
u32 graphRA;
u32 graphSP;
input3 = &sFaultContext->padInput[3];
if (CHECK_BTN_ALL(input3->press.button, 0x80)) {
faultCustomOptions = faultCustomOptions == 0;
}
if (faultCustomOptions) {
graphPC = graphOSThread.context.pc;
graphRA = graphOSThread.context.ra;
graphSP = graphOSThread.context.sp;
if (CHECK_BTN_ALL(input3->press.button, BTN_R)) {
faultCopyToLog = !faultCopyToLog;
FaultDrawer_SetOsSyncPrintfEnabled(faultCopyToLog);
}
if (CHECK_BTN_ALL(input3->press.button, BTN_A)) {
osSyncPrintf("GRAPH PC=%08x RA=%08x STACK=%08x\n", graphPC, graphRA, graphSP);
}
if (CHECK_BTN_ALL(input3->press.button, BTN_B)) {
FaultDrawer_SetDrawerFB(osViGetNextFramebuffer(), 0x140, 0xF0);
Fault_DrawRec(0, 0xD7, 0x140, 9, 1);
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_DrawText(0x20, 0xD8, "GRAPH PC %08x RA %08x SP %08x", graphPC, graphRA, graphSP);
}
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault/Fault_SetOptionsFromController3.s")
#endif
void Fault_SetOptions(void) {
Fault_UpdatePadImpl();
Fault_SetOptionsFromController3();
}
void Fault_ThreadEntry(void* arg) {
OSMesg msg;
u32 pad;
OSThread* faultedThread;
osSetEventMesg(10, &sFaultContext->queue, (OSMesg)1);
osSetEventMesg(12, &sFaultContext->queue, (OSMesg)2);
while (1) {
do {
osRecvMesg(&sFaultContext->queue, &msg, 1);
if (msg == (OSMesg)1) {
sFaultContext->msgId = 1;
osSyncPrintf("フォルトマネージャ:OS_EVENT_CPU_BREAKを受信しました\n");
} else if (msg == (OSMesg)2) {
sFaultContext->msgId = 2;
osSyncPrintf("フォルトマネージャ:OS_EVENT_FAULTを受信しました\n");
} else if (msg == (OSMesg)3) {
Fault_SetOptions();
faultedThread = NULL;
continue;
} else {
sFaultContext->msgId = 3;
osSyncPrintf("フォルトマネージャ:不明なメッセージを受信しました\n");
}
faultedThread = __osGetCurrFaultedThread();
osSyncPrintf("__osGetCurrFaultedThread()=%08x\n", faultedThread);
if (!faultedThread) {
faultedThread = Fault_FindFaultedThread();
osSyncPrintf("FindFaultedThread()=%08x\n", faultedThread);
}
} while (faultedThread == NULL);
__osSetFpcCsr(__osGetFpcCsr() & 0xFFFFF07F);
sFaultContext->faultedThread = faultedThread;
while (!sFaultContext->faultHandlerEnabled) {
Fault_Sleep(1000);
}
Fault_Sleep(500);
Fault_CommitFB();
if (sFaultContext->faultActive) {
Fault_Wait5Seconds();
} else {
Fault_DrawCornerRec(0xF801);
Fault_WaitForButtonCombo();
}
sFaultContext->faultActive = 1;
FaultDrawer_SetForeColor(0xFFFF);
FaultDrawer_SetBackColor(0);
do {
Fault_PrintThreadContext(faultedThread);
osSyncPrintfThreadContext(faultedThread);
Fault_WaitForInput();
Fault_DrawStackTrace(faultedThread, 0);
osSyncPrintfStackTrace(faultedThread, 0);
Fault_WaitForInput();
Fault_ProcessClients();
Fault_DrawMemDump((u32)(faultedThread->context.pc - 0x100), (u32)faultedThread->context.sp, 0, 0);
Fault_DrawStackTrace(faultedThread, 1);
osSyncPrintfStackTrace(faultedThread, 1);
Fault_WaitForInput();
Fault_FillScreenRed();
FaultDrawer_DrawText(0x40, 0x50, " CONGRATURATIONS! ");
FaultDrawer_DrawText(0x40, 0x5A, "All Pages are displayed.");
FaultDrawer_DrawText(0x40, 0x64, " THANK YOU! ");
FaultDrawer_DrawText(0x40, 0x6E, " You are great debugger!");
Fault_WaitForInput();
} while (!sFaultContext->exitDebugger);
while (!sFaultContext->exitDebugger) {
;
}
Fault_ResumeThread(faultedThread);
}
}
void Fault_SetFB(void* fb, u16 w, u16 h) {
sFaultContext->fb = fb;
FaultDrawer_SetDrawerFB(fb, w, h);
}
void Fault_Start(void) {
sFaultContext = &gFaultStruct;
bzero(sFaultContext, sizeof(FaultThreadStruct));
FaultDrawer_Init();
FaultDrawer_SetInputCallback(Fault_WaitForInput);
sFaultContext->exitDebugger = 0;
sFaultContext->msgId = 0;
sFaultContext->faultHandlerEnabled = 0;
sFaultContext->faultedThread = NULL;
sFaultContext->padCallback = &Fault_PadCallback;
sFaultContext->clients = NULL;
sFaultContext->faultActive = 0;
gFaultStruct.faultHandlerEnabled = 1;
osCreateMesgQueue(&sFaultContext->queue, sFaultContext->msg, 1);
StackCheck_Init(&sFaultThreadInfo, sFaultStack, sFaultStack + sizeof(sFaultStack), 0, 0x100, "fault");
osCreateThread(&sFaultContext->thread, 2, Fault_ThreadEntry, NULL, sFaultStack + sizeof(sFaultStack), 0x7F);
osStartThread(&sFaultContext->thread);
}
void Fault_HangupFaultClient(const char* arg0, char* arg1) {
osSyncPrintf("HungUp on Thread %d\n", osGetThreadId(NULL));
osSyncPrintf("%s\n", arg0 ? arg0 : "(NULL)");
osSyncPrintf("%s\n", arg1 ? arg1 : "(NULL)");
FaultDrawer_Printf("HungUp on Thread %d\n", osGetThreadId(NULL));
FaultDrawer_Printf("%s\n", arg0 ? arg0 : "(NULL)");
FaultDrawer_Printf("%s\n", arg1 ? arg1 : "(NULL)");
}
void Fault_AddHungupAndCrashImpl(const char* arg0, char* arg1) {
FaultClient client;
char padd[4];
Fault_AddClient(&client, (fault_client_func)Fault_HangupFaultClient, (void*)arg0, arg1);
*(u32*)0x11111111 = 0; // trigger an exception
}
void Fault_AddHungupAndCrash(const char* filename, u32 line) {
char msg[256];
sprintf(msg, "HungUp %s:%d", filename, line);
Fault_AddHungupAndCrashImpl(msg, NULL);
}
+180
View File
@@ -0,0 +1,180 @@
#include "global.h"
#include "vt.h"
FaultDrawer* sFaultDrawContext = &sFaultDrawerStruct;
FaultDrawer sFaultDrawerDefault = {
(u16*)0x803DA800, // fb - TODO map out buffers in this region and avoid hard-coded pointer
SCREEN_WIDTH, // w
SCREEN_HEIGHT, // h
16, // yStart
223, // yEnd
22, // xStart
297, // xEnd
GPACK_RGBA5551(255, 255, 255, 255), // foreColor
GPACK_RGBA5551(0, 0, 0, 0), // backColor
22, // cursorX
16, // cursorY
(u32*)&sFaultDrawerFont, // font
8, // charW
8, // charH
0, // charWPad
0, // charHPad
{
// printColors
GPACK_RGBA5551(0, 0, 0, 1),
GPACK_RGBA5551(255, 0, 0, 1),
GPACK_RGBA5551(0, 255, 0, 1),
GPACK_RGBA5551(255, 255, 0, 1),
GPACK_RGBA5551(0, 0, 255, 1),
GPACK_RGBA5551(255, 0, 255, 1),
GPACK_RGBA5551(0, 255, 255, 1),
GPACK_RGBA5551(255, 255, 255, 1),
GPACK_RGBA5551(120, 120, 120, 1),
GPACK_RGBA5551(176, 176, 176, 1),
},
0, // escCode
0, // osSyncPrintfEnabled
NULL, // inputCallback
};
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault_drawer/sFaultDrawerFont.s")
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
sFaultDrawContext->osSyncPrintfEnabled = enabled;
}
void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color) {
u16* fb;
s32 x, y;
s32 xDiff = sFaultDrawContext->w - xStart;
s32 yDiff = sFaultDrawContext->h - yStart;
s32 xSize = xEnd - xStart + 1;
s32 ySize = yEnd - yStart + 1;
if (xDiff > 0 && yDiff > 0) {
if (xDiff < xSize) {
xSize = xDiff;
}
if (yDiff < ySize) {
ySize = yDiff;
}
fb = sFaultDrawContext->fb + sFaultDrawContext->w * yStart + xStart;
for (y = 0; y < ySize; y++) {
for (x = 0; x < xSize; x++) {
*fb++ = color;
}
fb += sFaultDrawContext->w - xSize;
}
osWritebackDCacheAll();
}
}
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault_drawer/FaultDrawer_DrawChar.s")
s32 FaultDrawer_ColorToPrintColor(u16 color) {
s32 i;
for (i = 0; i < 10; i++) {
if (color == sFaultDrawContext->printColors[i]) {
return i;
}
}
return -1;
}
void FaultDrawer_UpdatePrintColor() {
s32 idx;
if (sFaultDrawContext->osSyncPrintfEnabled) {
osSyncPrintf(VT_RST);
idx = FaultDrawer_ColorToPrintColor(sFaultDrawContext->foreColor);
if (idx >= 0 && idx < 8) {
osSyncPrintf(VT_SGR("3%d"), idx);
}
idx = FaultDrawer_ColorToPrintColor(sFaultDrawContext->backColor);
if (idx >= 0 && idx < 8) {
osSyncPrintf(VT_SGR("4%d"), idx);
}
}
}
void FaultDrawer_SetForeColor(u16 color) {
sFaultDrawContext->foreColor = color;
FaultDrawer_UpdatePrintColor();
}
void FaultDrawer_SetBackColor(u16 color) {
sFaultDrawContext->backColor = color;
FaultDrawer_UpdatePrintColor();
}
void FaultDrawer_SetFontColor(u16 color) {
FaultDrawer_SetForeColor(color | 1); // force alpha to be set
}
void FaultDrawer_SetCharPad(s8 padW, s8 padH) {
sFaultDrawContext->charWPad = padW;
sFaultDrawContext->charHPad = padH;
}
void FaultDrawer_SetCursor(s32 x, s32 y) {
if (sFaultDrawContext->osSyncPrintfEnabled) {
osSyncPrintf(VT_CUP("%d", "%d"),
(y - sFaultDrawContext->yStart) / (sFaultDrawContext->charH + sFaultDrawContext->charHPad),
(x - sFaultDrawContext->xStart) / (sFaultDrawContext->charW + sFaultDrawContext->charWPad));
}
sFaultDrawContext->cursorX = x;
sFaultDrawContext->cursorY = y;
}
void FaultDrawer_FillScreen() {
if (sFaultDrawContext->osSyncPrintfEnabled) {
osSyncPrintf(VT_CLS);
}
FaultDrawer_DrawRecImpl(sFaultDrawContext->xStart, sFaultDrawContext->yStart, sFaultDrawContext->xEnd,
sFaultDrawContext->yEnd, sFaultDrawContext->backColor | 1);
FaultDrawer_SetCursor(sFaultDrawContext->xStart, sFaultDrawContext->yStart);
}
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault_drawer/FaultDrawer_FormatStringFunc.s")
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault_drawer/D_80099080.s")
void FaultDrawer_VPrintf(const char* str, char* args) { // va_list
_Printf((printf_func)FaultDrawer_FormatStringFunc, sFaultDrawContext, str, args);
}
void FaultDrawer_Printf(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
FaultDrawer_VPrintf(fmt, args);
}
void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
FaultDrawer_SetCursor(x, y);
FaultDrawer_VPrintf(fmt, args);
}
void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h) {
sFaultDrawContext->fb = (u16*)fb;
sFaultDrawContext->w = w;
sFaultDrawContext->h = h;
}
void FaultDrawer_SetInputCallback(void (*callback)()) {
sFaultDrawContext->inputCallback = callback;
}
void FaultDrawer_Init() {
sFaultDrawContext = &sFaultDrawerStruct;
bcopy(&sFaultDrawerDefault, sFaultDrawContext, sizeof(FaultDrawer));
sFaultDrawContext->fb = (u16*)((osMemSize | 0x80000000) - 0x25800);
}
+6 -7
View File
@@ -1,5 +1,4 @@
#include <ultra64.h>
#include <global.h>
#include "global.h"
u8 D_80096B20 = 1;
vu8 gViConfigUseDefault = 1;
@@ -35,8 +34,8 @@ void Idle_InitMemory(void) {
void* memEnd = (void*)(0x80000000 + osMemSize);
Idle_ClearMemory((void*)0x80000400, &gFramebuffer1);
Idle_ClearMemory(&D_80025D00, (int*)&boot_text_start);
Idle_ClearMemory(&code_bss_end, memEnd);
Idle_ClearMemory(&D_80025D00, (int*)&bootproc);
Idle_ClearMemory(&gGfxSPTaskYieldBuffer, memEnd);
}
#ifdef NON_MATCHING
@@ -52,7 +51,7 @@ void Idle_InitCodeAndMemory(void) {
oldSize = sDmaMgrDmaBuffSize;
sDmaMgrDmaBuffSize = 0;
DmaMgr_SendRequestImpl(&dmaReq, (u32)&code_text_start, (u32)_codeSegmentRomStart,
DmaMgr_SendRequestImpl(&dmaReq, (u32)_codeSegmentStart, (u32)_codeSegmentRomStart,
(u32)_codeSegmentRomEnd - (u32)_codeSegmentRomStart, 0, &queue, 0);
Idle_InitScreen();
Idle_InitMemory();
@@ -60,10 +59,10 @@ void Idle_InitCodeAndMemory(void) {
sDmaMgrDmaBuffSize = oldSize;
Idle_ClearMemory(&code_bss_start, &code_bss_end);
Idle_ClearMemory(_codeSegmentBssStart, _codeSegmentBssEnd);
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/boot/idle/Idle_InitCodeAndMemory.asm")
#pragma GLOBAL_ASM("asm/non_matchings/boot/idle/Idle_InitCodeAndMemory.s")
#endif
void Main_ThreadEntry(void* arg) {
+1 -2
View File
@@ -1,5 +1,4 @@
#include <ultra64.h>
#include <global.h>
#include "global.h"
vs32 gIrqMgrResetStatus = 0;
volatile OSTime sIrqMgrResetTime = 0;
+10
View File
@@ -0,0 +1,10 @@
#include "global.h"
// This file contains print functions that are used by fault.c, so they are placed in the fault module
void __osSyncVPrintf(UNK_TYPE4 param_1, ...) {
}
void osSyncPrintf(char* str, ...) {
}
void rmonPrintf(UNK_TYPE4 param_1, ...) {
}
+2 -3
View File
@@ -1,5 +1,4 @@
#include <ultra64.h>
#include <global.h>
#include "global.h"
void ViConfig_UpdateVi(u32 mode) {
if (mode != 0) {
@@ -27,7 +26,7 @@ void ViConfig_UpdateVi(u32 mode) {
osViSetMode(&gViConfigMode);
if (gViConfigAdditionalScanLines != 0) {
func_80087E00(gViConfigAdditionalScanLines);
osViExtendVStart(gViConfigAdditionalScanLines);
}
if (gViConfigFeatures != 0) {
+3 -4
View File
@@ -1,5 +1,4 @@
#include <ultra64.h>
#include <global.h>
#include "global.h"
u8 sYaz0DataBuffer[0x400];
u8* sYaz0CurDataEnd;
@@ -50,7 +49,7 @@ void* Yaz0_NextDMA(void* curSrcPos) {
} else {
oldPri = osGetThreadPri(NULL);
osSetThreadPri(NULL, 0x7F);
Fault_Log("圧縮展開異常\n");
osSyncPrintf("圧縮展開異常\n");
osSetThreadPri(NULL, oldPri);
}
@@ -131,7 +130,7 @@ void Yaz0_Decompress(u32 romStart, void* dst, u32 size) {
if (sYaz0CurDataEnd != NULL) {
while (sYaz0CurDataEnd != NULL) {
func_80087A1C(10);
Sleep_Usec(10);
}
}
+2 -5
View File
@@ -1,5 +1,4 @@
#include <ultra64.h>
#include <global.h>
#include "global.h"
u32 sDmaMgrDmaBuffSize = 0x2000;
@@ -203,8 +202,6 @@ s32 DmaMgr_SendRequest0(void* vramStart, u32 vromStart, u32 size) {
return 0;
}
const char dmamgrThreadName[] = "dmamgr";
#ifdef NON_MATCHING
// TODO missing a useless move initializing v0, and some reorderings
void DmaMgr_Start() {
@@ -226,7 +223,7 @@ void DmaMgr_Start() {
osStartThread(&sDmaMgrThread);
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/boot/z_std_dma/DmaMgr_Start.asm")
#pragma GLOBAL_ASM("asm/non_matchings/boot/z_std_dma/DmaMgr_Start.s")
#endif
void DmaMgr_Stop() {