summaryrefslogtreecommitdiff
path: root/include/JSystem/JKernel
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2026-09-17 10:05:55 -0400
committerGitHub <noreply@github.com>2026-09-17 10:05:55 -0400
commitf38b962a5844502889ec00a98d0c9ed2a1151695 (patch)
tree26f19c014075891d18af15af95b2764feb63beaf /include/JSystem/JKernel
parent78f95573067988ad5812c040d8a6a77a78eb0dea (diff)
demo d_file_error OK, fmap/fmap2 work, misc (#1208)
* d_file_error OK, use J2DPane inlines everywhere * d_menu_fmap demo work * fmap and fmap2 work * fix demo regression with ternary fakematch * inline cleanup, f_pc_profile OK for demo * fix min/max bss order * lstair almost for demo
Diffstat (limited to 'include/JSystem/JKernel')
-rw-r--r--include/JSystem/JKernel/JKRExpHeap.h4
-rw-r--r--include/JSystem/JKernel/JKRHeap.h24
-rw-r--r--include/JSystem/JKernel/JKRSolidHeap.h2
-rw-r--r--include/JSystem/JKernel/JKRStdHeap.h2
4 files changed, 14 insertions, 18 deletions
diff --git a/include/JSystem/JKernel/JKRExpHeap.h b/include/JSystem/JKernel/JKRExpHeap.h
index cdbc89f1..b1043ae3 100644
--- a/include/JSystem/JKernel/JKRExpHeap.h
+++ b/include/JSystem/JKernel/JKRExpHeap.h
@@ -62,10 +62,12 @@ public:
s32 getUsedSize(u8 groupId) const;
s32 getTotalUsedSize(void) const;
- CMemBlock* getHeadUsedList() const { return mHeadUsedList; }
+ CMemBlock* getUsedFirst() { return mHeadUsedList; }
void setAllocationMode(EAllocMode mode) {
mAllocMode = mode;
}
+ static s32 getUsedSize_(JKRExpHeap* heap) { return heap->mSize - heap->getTotalFreeSize(); }
+ static void* getState_(TState* state) { return getState_buf_(state); }
public:
/* vt[04] */ virtual u32 getHeapType(); /* override */
diff --git a/include/JSystem/JKernel/JKRHeap.h b/include/JSystem/JKernel/JKRHeap.h
index d0b9d283..9323fcbe 100644
--- a/include/JSystem/JKernel/JKRHeap.h
+++ b/include/JSystem/JKernel/JKRHeap.h
@@ -83,18 +83,16 @@ public:
/* vt[23] */ virtual void state_dump(JKRHeap::TState const& p) const;
void setDebugFill(bool debugFill) { mDebugFill = debugFill; }
- bool getDebugFill() const { return mDebugFill; }
- void* getStartAddr() const { return (void*)mStart; }
- void* getEndAddr() const { return (void*)mEnd; }
- u32 getSize() const { return mSize; }
+ void* getStartAddr() { return (void*)mStart; }
+ void* getEndAddr() { return (void*)mEnd; }
bool getErrorFlag() const { return mErrorFlag; }
- void callErrorHandler(JKRHeap* heap, u32 size, int alignment) {
+ void callErrorHandler(void* heap, u32 size, int alignment) {
if (mErrorHandler) {
(*mErrorHandler)(heap, size, alignment);
}
}
- JKRHeap* getParent() const {
+ JKRHeap* getParent() {
JSUTree<JKRHeap>* parent = mChildTree.getParent();
return parent->getObject();
}
@@ -102,8 +100,8 @@ public:
JSUTree<JKRHeap>& getHeapTree() { return mChildTree; }
void appendDisposer(JKRDisposer* disposer) { mDisposerList.append(&disposer->mLink); }
void removeDisposer(JKRDisposer* disposer) { mDisposerList.remove(&disposer->mLink); }
- void lock() { OSLockMutex(&mMutex); }
- void unlock() { OSUnlockMutex(&mMutex); }
+ void lock() const { OSLockMutex(const_cast<OSMutex*>(&mMutex)); }
+ void unlock() const { OSUnlockMutex(const_cast<OSMutex*>(&mMutex)); }
u32 getHeapSize() { return mSize; }
protected:
@@ -137,6 +135,7 @@ public:
static JKRErrorHandler setErrorHandler(JKRErrorHandler errorHandler);
+ static bool isDefaultDebugFill() { return sDefaultFillFlag; }
static void setDefaultDebugFill(bool status) { sDefaultFillFlag = status; }
static void* getCodeStart(void) { return mCodeStart; }
static void* getCodeEnd(void) { return mCodeEnd; }
@@ -144,14 +143,9 @@ public:
static void* getUserRamEnd(void) { return mUserRamEnd; }
static u32 getMemorySize(void) { return mMemorySize; }
static JKRHeap* getRootHeap() { return sRootHeap; }
-#if DEBUG
- static JKRHeap* getRootHeap2() { return sRootHeap2; }
-#endif
static JKRHeap* getSystemHeap() { return sSystemHeap; }
static JKRHeap* getCurrentHeap() { return sCurrentHeap; }
- static void setSystemHeap(JKRHeap* heap) { sSystemHeap = heap; }
- static void setCurrentHeap(JKRHeap* heap) { sCurrentHeap = heap; }
static void setState_u32ID_(TState* state, u32 id) { state->mId = id; }
static void setState_uUsedSize_(TState* state, u32 usedSize) { state->mUsedSize = usedSize; }
@@ -159,7 +153,6 @@ public:
state->mCheckCode = checkCode;
}
static void* getState_buf_(TState* state) { return &state->mBuf; }
- static void* getState_(TState* state) { return getState_buf_(state); }
static void* mCodeStart;
static void* mCodeEnd;
@@ -168,9 +161,6 @@ public:
static u32 mMemorySize;
static JKRHeap* sRootHeap;
-#if DEBUG
- static JKRHeap* sRootHeap2;
-#endif
static JKRHeap* sSystemHeap;
static JKRHeap* sCurrentHeap;
diff --git a/include/JSystem/JKernel/JKRSolidHeap.h b/include/JSystem/JKernel/JKRSolidHeap.h
index 9c0b6c98..ba14ff58 100644
--- a/include/JSystem/JKernel/JKRSolidHeap.h
+++ b/include/JSystem/JKernel/JKRSolidHeap.h
@@ -58,6 +58,8 @@ public:
s32 adjustSize(void);
static JKRSolidHeap* create(u32, JKRHeap*, bool);
+
+ static void* getState_(TState* state) { return getState_buf_(state); }
}; // Size: 0x80
inline JKRSolidHeap* JKRCreateSolidHeap(u32 size, JKRHeap* parent, bool errorFlag) { return JKRSolidHeap::create(size, parent, errorFlag); }
diff --git a/include/JSystem/JKernel/JKRStdHeap.h b/include/JSystem/JKernel/JKRStdHeap.h
index 21a5eb08..55573696 100644
--- a/include/JSystem/JKernel/JKRStdHeap.h
+++ b/include/JSystem/JKernel/JKRStdHeap.h
@@ -31,6 +31,8 @@ public:
s32 do_getSize(void* ptr) { return OSReferentSize(ptr); };
s32 do_getTotalFreeSize() { return getFreeSize(); };
+ static void* getState_(TState* state) { return getState_buf_(state); }
+
OSHeapHandle mHeapHandle;
};