Linux crash handler (#1209)

* crash handler linux

* cleanups

* missing underscore

* more cleanups

* cleanups

* 32 bit
This commit is contained in:
louist103 2022-08-31 22:59:38 -04:00 committed by GitHub
commit 584a4ad818
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 218 additions and 11 deletions

View file

@ -1656,7 +1656,7 @@ void PadMgr_HandleRetraceMsg(PadMgr* padmgr);
void PadMgr_HandlePreNMI(PadMgr* padmgr);
// This function must remain commented out, because it is called incorrectly in
// fault.c (actual bug in game), and the compiler notices and won't compile it
// void PadMgr_RequestPadData(PadMgr* padmgr, Input* inputs, s32 mode);
void PadMgr_RequestPadData(PadMgr* padmgr, Input* inputs, s32 mode);
void PadMgr_Init(PadMgr* padmgr, OSMesgQueue* siIntMsgQ, IrqMgr* irqMgr, OSId id, OSPri priority, void* stack);
void Sched_SwapFrameBuffer(CfbInfo* cfbInfo);
void func_800C84E4(SchedContext* sc, CfbInfo* cfbInfo);

View file

@ -3,20 +3,20 @@
#include "z64.h"
#define DECLARE_SEGMENT(name) \
//extern u8 _##name##SegmentStart[]; \
#define DECLARE_SEGMENT(name)
//extern u8 _##name##SegmentStart[];
//extern u8 _##name##SegmentEnd[];
#define DECLARE_ROM_SEGMENT(name) \
//extern u8 _##name##SegmentRomStart[]; \
#define DECLARE_ROM_SEGMENT(name)
//extern u8 _##name##SegmentRomStart[];
//extern u8 _##name##SegmentRomEnd[];
#define DECLARE_BSS_SEGMENT(name) \
extern u8 _##name##SegmentBssStart[]; \
extern u8 _##name##SegmentBssEnd[];
#define DECLARE_OVERLAY_SEGMENT(name) \
//DECLARE_SEGMENT(ovl_##name) \
#define DECLARE_OVERLAY_SEGMENT(name)
//DECLARE_SEGMENT(ovl_##name)
//DECLARE_ROM_SEGMENT(ovl_##name)
DECLARE_SEGMENT(boot)

View file

@ -32,6 +32,8 @@ private:
#endif
#ifndef __cplusplus
void InitOTR(void);
void DeinitOTR(void);
void VanillaItemTable_Init();
void OTRAudio_Init();
void InitAudio();

View file

@ -293,7 +293,7 @@ void Fault_Sleep(u32 duration) {
void Fault_PadCallback(Input* input) {
//! @bug This function is not called correctly and thus will crash from reading a bad pointer at 0x800C7E4C
PadMgr_RequestPadData(input, 0);
PadMgr_RequestPadData(&gPadMgr, input, 0);
}
void Fault_UpdatePadImpl()

View file

@ -3,6 +3,8 @@
#include <soh/Enhancements/bootcommands.h>
#include "soh/OTRGlobals.h"
#include "../libultraship/CrashHandler.h"
s32 gScreenWidth = SCREEN_WIDTH;
s32 gScreenHeight = SCREEN_HEIGHT;
@ -38,6 +40,10 @@ void Main_LogSystemHeap(void) {
int main(int argc, char** argv)
{
#ifdef __linux__
SetupHandlerLinux();
#endif
GameConsole_Init();
InitOTR();
BootCommands_Init();
@ -64,14 +70,14 @@ void Main(void* arg) {
Fault_Init();
SysCfb_Init(0);
Heaps_Alloc();
sysHeap = gSystemHeap;
sysHeap = (uintptr_t)gSystemHeap;
fb = SysCfb_GetFbPtr(0);
gSystemHeapSize = 1024 * 1024 * 4;
// "System heap initalization"
osSyncPrintf("システムヒープ初期化 %08x-%08x %08x\n", sysHeap, fb, gSystemHeapSize);
SystemHeap_Init(sysHeap, gSystemHeapSize); // initializes the system heap
SystemHeap_Init((void*)sysHeap, gSystemHeapSize); // initializes the system heap
if (osMemSize >= 0x800000) {
debugHeap = SysCfb_GetFbEnd();
debugHeap = (void*)SysCfb_GetFbEnd();
debugHeapSize = (0x80600000 - (uintptr_t)debugHeap);
} else {
debugHeapSize = 0x400;