mirror of
https://github.com/zeldaret/botw
synced 2026-08-02 08:22:28 -04:00
non request BaseProcHandle stuff
refactoring baseProcHandle.cpp refactoring
This commit is contained in:
@@ -12,7 +12,6 @@ public:
|
||||
~SetInstEventFlagAction() override;
|
||||
|
||||
void oneShot() override;
|
||||
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(SetInstEventFlagAction, 0x20);
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#include <prim/seadSafeString.h>
|
||||
#include <prim/seadTypedBitFlag.h>
|
||||
#include <thread/seadAtomic.h>
|
||||
#include "KingSystem/ActorSystem/actBaseProcHandle.h"
|
||||
#include "KingSystem/ActorSystem/actBaseProcJob.h"
|
||||
#include "KingSystem/ActorSystem/actBaseProcMap.h"
|
||||
#include "KingSystem/ActorSystem/actBaseProcHandle.h"
|
||||
#include "KingSystem/Utils/StrTreeMap.h"
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "KingSystem/ActorSystem/actBaseProcHandle.h"
|
||||
|
||||
namespace ksys::act {
|
||||
|
||||
BaseProcHandle::BaseProcHandle() {
|
||||
mUnit = nullptr;
|
||||
mFlag = 0;
|
||||
}
|
||||
|
||||
BaseProcHandle::~BaseProcHandle() {
|
||||
if (mUnit) {
|
||||
mUnit->deleteProc(0, this);
|
||||
mUnit = nullptr;
|
||||
}
|
||||
mFlag = 0;
|
||||
}
|
||||
|
||||
bool BaseProcHandle::procReady() {
|
||||
return mUnit && mUnit->isReady();
|
||||
}
|
||||
|
||||
BaseProc* BaseProcHandle::getProc() {
|
||||
if (mUnit)
|
||||
return mUnit->getProc();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace ksys::act
|
||||
@@ -1,19 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include "actBaseProcUnit.h"
|
||||
#include "KingSystem/ActorSystem/actBaseProc.h"
|
||||
#include "KingSystem/ActorSystem/actBaseProcUnit.h"
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
namespace ksys::act {
|
||||
|
||||
class BaseProcUnit;
|
||||
class BaseProc;
|
||||
|
||||
class BaseProcHandle {
|
||||
public:
|
||||
BaseProcHandle();
|
||||
~BaseProcHandle();
|
||||
|
||||
static BaseProcHandle sDummyBaseProcHandle;
|
||||
bool procReady();
|
||||
|
||||
BaseProc* getProc();
|
||||
|
||||
static BaseProcHandle sDummyHandle;
|
||||
|
||||
private:
|
||||
BaseProcUnit* mUnit;
|
||||
u8 mFlag;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h"
|
||||
#include "KingSystem/ActorSystem/actBaseProc.h"
|
||||
#include "KingSystem/Utils/Debug.h"
|
||||
|
||||
namespace ksys::act {
|
||||
|
||||
// NON_MATCHING: Equivalent but branches are off.
|
||||
@@ -15,7 +16,7 @@ bool BaseProcUnit::setProc(BaseProc* proc) {
|
||||
if (mProc)
|
||||
mProc = nullptr;
|
||||
|
||||
if (mHandle == &BaseProcHandle::sDummyBaseProcHandle)
|
||||
if (mHandle == &BaseProcHandle::sDummyHandle)
|
||||
return false;
|
||||
|
||||
if (mHandle) {
|
||||
@@ -51,7 +52,7 @@ bool BaseProcUnit::setProc(BaseProc* proc) {
|
||||
}
|
||||
|
||||
bool BaseProcUnit::isParentHandleDefault() const {
|
||||
return mHandle == &BaseProcHandle::sDummyBaseProcHandle;
|
||||
return mHandle == &BaseProcHandle::sDummyHandle;
|
||||
}
|
||||
|
||||
} // namespace ksys::act
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <thread/seadAtomic.h>
|
||||
#include <thread/seadCriticalSection.h>
|
||||
#include "KingSystem/ActorSystem/actBaseProcHandle.h"
|
||||
#include <thread/seadAtomic.h>
|
||||
|
||||
namespace ksys::act {
|
||||
|
||||
class BaseProc;
|
||||
@@ -11,12 +12,15 @@ class BaseProcHandle;
|
||||
|
||||
class BaseProcUnit {
|
||||
public:
|
||||
bool deleteProc(void*, BaseProcHandle* handle);
|
||||
bool deleteProc(u32, BaseProcHandle* handle);
|
||||
bool setProc(BaseProc* proc);
|
||||
void unlinkProc(BaseProc* proc);
|
||||
void cleanUp(BaseProc* proc, bool set_flag_5);
|
||||
bool isParentHandleDefault() const;
|
||||
|
||||
BaseProc* getProc() const { return mProc; }
|
||||
bool isReady() const { return mFlags == 2; }
|
||||
|
||||
private:
|
||||
u32 mFlags;
|
||||
sead::Atomic<BaseProcHandle*> mHandle;
|
||||
|
||||
Reference in New Issue
Block a user