mirror of https://github.com/zeldaret/mm.git
parent
6ff77ab092
commit
03c8d46ed2
|
@ -2684,10 +2684,7 @@ void func_8018450C(PlayState* play, SkeletonInfo* skeleton, Mtx* mtx, OverrideKe
|
||||||
// void func_801850A0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
// void func_801850A0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||||
// void func_801853C8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
// void func_801853C8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||||
// void func_80185460(void);
|
// void func_80185460(void);
|
||||||
//void Slowly_Main(SlowlyTask* slowly);
|
|
||||||
//void Slowly_ThreadEntry(SlowlyTask* slowly);
|
|
||||||
void Slowly_Start(SlowlyTask* slowly, void* stack, void (*callback)(), void* callbackArg0, void* callbackArg1);
|
|
||||||
void Slowly_Stop(SlowlyTask* slowly);
|
|
||||||
// void func_801857C0(void);
|
// void func_801857C0(void);
|
||||||
// char* func_801857D0(void);
|
// char* func_801857D0(void);
|
||||||
// void func_80185864(void);
|
// void func_80185864(void);
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#ifndef SLOWLY_H
|
||||||
|
#define SLOWLY_H
|
||||||
|
|
||||||
|
#include "ultra64.h"
|
||||||
|
|
||||||
|
#define SLOWLY_STATUS_DONE (1 << 0)
|
||||||
|
#define SLOWLY_STATUS_STARTED (1 << 1)
|
||||||
|
|
||||||
|
typedef void (*SlowlyCallbackZero)(void);
|
||||||
|
typedef void (*SlowlyCallbackOne)(void*);
|
||||||
|
typedef void (*SlowlyCallbackTwo)(void*, void*);
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
SlowlyCallbackZero zero;
|
||||||
|
SlowlyCallbackOne one;
|
||||||
|
SlowlyCallbackTwo two;
|
||||||
|
} SlowlyCallback; // size = 0x4
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* 0x000 */ OSThread thread;
|
||||||
|
/* 0x1B0 */ u8 argCount;
|
||||||
|
/* 0x1B1 */ u8 status;
|
||||||
|
/* 0x1B4 */ SlowlyCallback callback;
|
||||||
|
/* 0x1B8 */ void* arg0;
|
||||||
|
/* 0x1BC */ void* arg1;
|
||||||
|
} SlowlyMgr; // size = 0x1C0
|
||||||
|
|
||||||
|
void Slowly_Init(SlowlyMgr* slowly, void* stack, SlowlyCallbackTwo callback, void* arg0, void* arg1);
|
||||||
|
void Slowly_Destroy(SlowlyMgr* slowly);
|
||||||
|
|
||||||
|
#endif
|
|
@ -219,25 +219,6 @@ typedef struct {
|
||||||
/* 0x10 */ OSTime resetTime;
|
/* 0x10 */ OSTime resetTime;
|
||||||
} NmiBuff; // size >= 0x18
|
} NmiBuff; // size >= 0x18
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SLOWLY_CALLBACK_NO_ARGS,
|
|
||||||
SLOWLY_CALLBACK_ONE_ARG,
|
|
||||||
SLOWLY_CALLBACK_TWO_ARGS
|
|
||||||
} SlowlyCallbackArgCount;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
/* 0x000 */ OSThread thread;
|
|
||||||
/* 0x1B0 */ u8 callbackArgCount;
|
|
||||||
/* 0x1B1 */ u8 status;
|
|
||||||
/* 0x1B4 */ union {
|
|
||||||
void (*callback0)(void);
|
|
||||||
void (*callback1)(void*);
|
|
||||||
void (*callback2)(void*, void*);
|
|
||||||
};
|
|
||||||
/* 0x1B8 */ void* callbackArg0;
|
|
||||||
/* 0x1BC */ void* callbackArg1;
|
|
||||||
} SlowlyTask; // size = 0x1C0
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ int unk0;
|
/* 0x00 */ int unk0;
|
||||||
/* 0x04 */ void* unk4;
|
/* 0x04 */ void* unk4;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "slowly.h"
|
||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -411,7 +412,7 @@ void PreRender_ApplyFilters(PreRender* this) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern SlowlyTask D_801F6E00;
|
extern SlowlyMgr sSlowlyMgr;
|
||||||
extern s32 D_801F6FC0;
|
extern s32 D_801F6FC0;
|
||||||
extern StackEntry sSlowlyStackInfo;
|
extern StackEntry sSlowlyStackInfo;
|
||||||
extern STACK(sSlowlyStack, 0x1000);
|
extern STACK(sSlowlyStack, 0x1000);
|
||||||
|
@ -423,12 +424,12 @@ void PreRender_ApplyFiltersSlowlyInit(PreRender* this) {
|
||||||
if ((this->cvgSave != NULL) && (this->fbufSave != NULL)) {
|
if ((this->cvgSave != NULL) && (this->fbufSave != NULL)) {
|
||||||
if (D_801F6FC0) {
|
if (D_801F6FC0) {
|
||||||
StackCheck_Cleanup(&sSlowlyStackInfo);
|
StackCheck_Cleanup(&sSlowlyStackInfo);
|
||||||
Slowly_Stop(&D_801F6E00);
|
Slowly_Destroy(&sSlowlyMgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->unk_4D = 1;
|
this->unk_4D = 1;
|
||||||
StackCheck_Init(&sSlowlyStackInfo, sSlowlyStack, STACK_TOP(sSlowlyStack), 0, 0x100, "slowly");
|
StackCheck_Init(&sSlowlyStackInfo, sSlowlyStack, STACK_TOP(sSlowlyStack), 0, 0x100, "slowly");
|
||||||
Slowly_Start(&D_801F6E00, STACK_TOP(sSlowlyStack), PreRender_ApplyFilters, this, NULL);
|
Slowly_Init(&sSlowlyMgr, STACK_TOP(sSlowlyStack), (void*)PreRender_ApplyFilters, this, NULL);
|
||||||
D_801F6FC0 = true;
|
D_801F6FC0 = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -439,7 +440,7 @@ void PreRender_ApplyFiltersSlowlyInit(PreRender* this) {
|
||||||
void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this) {
|
void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this) {
|
||||||
if (D_801F6FC0) {
|
if (D_801F6FC0) {
|
||||||
StackCheck_Cleanup(&sSlowlyStackInfo);
|
StackCheck_Cleanup(&sSlowlyStackInfo);
|
||||||
Slowly_Stop(&D_801F6E00);
|
Slowly_Destroy(&sSlowlyMgr);
|
||||||
D_801F6FC0 = false;
|
D_801F6FC0 = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +1,58 @@
|
||||||
|
/**
|
||||||
|
* @file sys_slowly.c
|
||||||
|
*
|
||||||
|
* This file implements a manager for running an asynchronous task on a thread with the lowest priority.
|
||||||
|
*
|
||||||
|
* The task callback is expected to have up to 2 void* arguments and have a void return. Setting `argCount` will adjust
|
||||||
|
* how many args the callback gets called with, but defaults to 2 and using the 2 argument callback.
|
||||||
|
*
|
||||||
|
* @note: `argCount` must be set manually, as this file implements no way to configure it.
|
||||||
|
*/
|
||||||
|
#include "slowly.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#define SLOWLY_STATUS_DONE (1 << 0)
|
void Slowly_Main(SlowlyMgr* slowly) {
|
||||||
#define SLOWLY_STATUS_STARTED (1 << 1)
|
|
||||||
|
|
||||||
void Slowly_Main(SlowlyTask* slowly) {
|
|
||||||
slowly->status |= SLOWLY_STATUS_STARTED;
|
slowly->status |= SLOWLY_STATUS_STARTED;
|
||||||
|
|
||||||
switch (slowly->callbackArgCount) {
|
switch (slowly->argCount) {
|
||||||
case SLOWLY_CALLBACK_NO_ARGS:
|
case 0:
|
||||||
slowly->callback0();
|
slowly->callback.zero();
|
||||||
break;
|
break;
|
||||||
case SLOWLY_CALLBACK_ONE_ARG:
|
|
||||||
slowly->callback1(slowly->callbackArg0);
|
case 1:
|
||||||
|
slowly->callback.one(slowly->arg0);
|
||||||
break;
|
break;
|
||||||
case SLOWLY_CALLBACK_TWO_ARGS:
|
|
||||||
slowly->callback2(slowly->callbackArg0, slowly->callbackArg1);
|
case 2:
|
||||||
|
slowly->callback.two(slowly->arg0, slowly->arg1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
slowly->status |= SLOWLY_STATUS_DONE;
|
slowly->status |= SLOWLY_STATUS_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slowly_ThreadEntry(SlowlyTask* slowly) {
|
void Slowly_ThreadEntry(void* arg) {
|
||||||
|
SlowlyMgr* slowly = (SlowlyMgr*)arg;
|
||||||
|
|
||||||
Slowly_Main(slowly);
|
Slowly_Main(slowly);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slowly_Start(SlowlyTask* slowly, void* stack, void (*callback)(), void* callbackArg0, void* callbackArg1) {
|
void Slowly_Init(SlowlyMgr* slowly, void* stack, SlowlyCallbackTwo callback, void* arg0, void* arg1) {
|
||||||
bzero(slowly, sizeof(SlowlyTask));
|
bzero(slowly, sizeof(SlowlyMgr));
|
||||||
|
|
||||||
slowly->callbackArgCount = SLOWLY_CALLBACK_TWO_ARGS;
|
slowly->argCount = 2;
|
||||||
slowly->status = 0;
|
slowly->status = 0;
|
||||||
slowly->callback0 = callback;
|
slowly->callback.two = callback;
|
||||||
slowly->callbackArg0 = callbackArg0;
|
slowly->arg0 = arg0;
|
||||||
slowly->callbackArg1 = callbackArg1;
|
slowly->arg1 = arg1;
|
||||||
|
|
||||||
osCreateThread(&slowly->thread, Z_THREAD_ID_SLOWLY, Slowly_ThreadEntry, slowly, stack, Z_PRIORITY_SLOWLY);
|
osCreateThread(&slowly->thread, Z_THREAD_ID_SLOWLY, Slowly_ThreadEntry, slowly, stack, Z_PRIORITY_SLOWLY);
|
||||||
osStartThread(&slowly->thread);
|
osStartThread(&slowly->thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slowly_Stop(SlowlyTask* slowly) {
|
void Slowly_Destroy(SlowlyMgr* slowly) {
|
||||||
osDestroyThread(&slowly->thread);
|
osDestroyThread(&slowly->thread);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3445,8 +3445,8 @@
|
||||||
0x80185460:("func_80185460",),
|
0x80185460:("func_80185460",),
|
||||||
0x80185660:("Slowly_Main",),
|
0x80185660:("Slowly_Main",),
|
||||||
0x801856FC:("Slowly_ThreadEntry",),
|
0x801856FC:("Slowly_ThreadEntry",),
|
||||||
0x8018571C:("Slowly_Start",),
|
0x8018571C:("Slowly_Init",),
|
||||||
0x801857A0:("Slowly_Stop",),
|
0x801857A0:("Slowly_Destroy",),
|
||||||
0x801857C0:("func_801857C0",),
|
0x801857C0:("func_801857C0",),
|
||||||
0x801857D0:("func_801857D0",),
|
0x801857D0:("func_801857D0",),
|
||||||
0x80185864:("func_80185864",),
|
0x80185864:("func_80185864",),
|
||||||
|
|
|
@ -4061,7 +4061,7 @@
|
||||||
0x801F6D50:("sBombersNotebook","UNK_TYPE1","",0x1),
|
0x801F6D50:("sBombersNotebook","UNK_TYPE1","",0x1),
|
||||||
0x801F6DFC:("sBombersNotebookOpen","u8","",0x1),
|
0x801F6DFC:("sBombersNotebookOpen","u8","",0x1),
|
||||||
0x801F6DFD:("sMotionBlurStatus","UNK_TYPE1","",0x1),
|
0x801F6DFD:("sMotionBlurStatus","UNK_TYPE1","",0x1),
|
||||||
0x801F6E00:("D_801F6E00","SlowlyTask","",0x1c0),
|
0x801F6E00:("sSlowlyMgr","SlowlyMgr","",0x1c0),
|
||||||
0x801F6FC0:("D_801F6FC0","UNK_TYPE1","",0x1),
|
0x801F6FC0:("D_801F6FC0","UNK_TYPE1","",0x1),
|
||||||
0x801F6FC8:("sSlowlyStackInfo","StackEntry","",0x1c),
|
0x801F6FC8:("sSlowlyStackInfo","StackEntry","",0x1c),
|
||||||
0x801F6FE8:("sSlowlyStack","u8","[4096]",0x1000),
|
0x801F6FE8:("sSlowlyStack","u8","[4096]",0x1000),
|
||||||
|
|
|
@ -2959,8 +2959,8 @@ asm/non_matchings/code/c_keyframe/func_801853C8.s,func_801853C8,0x801853C8,0x26
|
||||||
asm/non_matchings/code/c_keyframe/func_80185460.s,func_80185460,0x80185460,0x80
|
asm/non_matchings/code/c_keyframe/func_80185460.s,func_80185460,0x80185460,0x80
|
||||||
asm/non_matchings/code/sys_slowly/Slowly_Main.s,Slowly_Main,0x80185660,0x27
|
asm/non_matchings/code/sys_slowly/Slowly_Main.s,Slowly_Main,0x80185660,0x27
|
||||||
asm/non_matchings/code/sys_slowly/Slowly_ThreadEntry.s,Slowly_ThreadEntry,0x801856FC,0x8
|
asm/non_matchings/code/sys_slowly/Slowly_ThreadEntry.s,Slowly_ThreadEntry,0x801856FC,0x8
|
||||||
asm/non_matchings/code/sys_slowly/Slowly_Start.s,Slowly_Start,0x8018571C,0x21
|
asm/non_matchings/code/sys_slowly/Slowly_Init.s,Slowly_Init,0x8018571C,0x21
|
||||||
asm/non_matchings/code/sys_slowly/Slowly_Stop.s,Slowly_Stop,0x801857A0,0x8
|
asm/non_matchings/code/sys_slowly/Slowly_Destroy.s,Slowly_Destroy,0x801857A0,0x8
|
||||||
asm/non_matchings/code/sys_flashrom/func_801857C0.s,func_801857C0,0x801857C0,0x4
|
asm/non_matchings/code/sys_flashrom/func_801857C0.s,func_801857C0,0x801857C0,0x4
|
||||||
asm/non_matchings/code/sys_flashrom/func_801857D0.s,func_801857D0,0x801857D0,0x25
|
asm/non_matchings/code/sys_flashrom/func_801857D0.s,func_801857D0,0x801857D0,0x25
|
||||||
asm/non_matchings/code/sys_flashrom/func_80185864.s,func_80185864,0x80185864,0x29
|
asm/non_matchings/code/sys_flashrom/func_80185864.s,func_80185864,0x80185864,0x29
|
||||||
|
|
|
Loading…
Reference in New Issue