summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorelijah-thomas774 <elijahthomas774@gmail.com>2024-05-12 16:04:01 -0400
committerelijah-thomas774 <elijahthomas774@gmail.com>2024-05-12 16:04:01 -0400
commit62e0778390f838cdb92f16b3582e2d76299ae8a5 (patch)
tree56f654268089544b7d3625b4cf60fc9fb087be97 /src
parent94ec354dde88a3e5e9f3f5b23f3506f83f0beb80 (diff)
fixed up typedef for u32 and s32 from mistake long ago
Diffstat (limited to 'src')
-rw-r--r--src/d/d_base.cpp14
-rw-r--r--src/egg/core/eggController.cpp5
-rw-r--r--src/egg/core/eggHeap.cpp9
-rw-r--r--src/egg/math/eggMatrix.cpp2
-rw-r--r--src/f/f_base.cpp8
-rw-r--r--src/m/m_heap.cpp128
-rw-r--r--src/nw4r/ut/ut_DvdFileStream.cpp20
-rw-r--r--src/nw4r/ut/ut_DvdLockedFileStream.cpp10
-rw-r--r--src/nw4r/ut/ut_FileStream.cpp6
-rw-r--r--src/nw4r/ut/ut_IOStream.cpp6
-rw-r--r--src/nw4r/ut/ut_LockedCache.cpp6
-rw-r--r--src/nw4r/ut/ut_NandFileStream.cpp30
-rw-r--r--src/nw4r/ut/ut_binaryFileFormat.cpp2
13 files changed, 115 insertions, 131 deletions
diff --git a/src/d/d_base.cpp b/src/d/d_base.cpp
index 0ae747e4..41c03e5a 100644
--- a/src/d/d_base.cpp
+++ b/src/d/d_base.cpp
@@ -11,7 +11,7 @@ dBase_c::dBase_c() : fBase_c() {
void dBase_c::postDraw(fBase_c::MAIN_STATE_e status) {
if (status != CANCELED) {
- baseProperties |= 0x100;
+ baseProperties |= 0x100;
} else {
baseProperties &= ~0x100;
}
@@ -30,7 +30,7 @@ int dBase_c::preExecute() {
void dBase_c::postExecute(fBase_c::MAIN_STATE_e status) {
if (status != CANCELED) {
- baseProperties |= 0x4;
+ baseProperties |= 0x4;
} else {
baseProperties &= ~0x4;
}
@@ -53,7 +53,7 @@ void dBase_c::resetFlags() {
s_NextExecuteControlFlags = 0;
}
-bool dBase_c::isActorPlayer(dBase_c& base) {
+bool dBase_c::isActorPlayer(dBase_c &base) {
return base.profile_name == fProfile::PLAYER;
}
@@ -70,12 +70,12 @@ void dBase_c::initLoader() {
fBase_c::sUnloadCallback = unloadCallback;
}
-dBase_c* dBase_c::createBase(ProfileName profName, dBase_c* parent, unsigned long param, u8 grouptype) {
- return static_cast<dBase_c*>(fBase_c::createChild(profName, parent, param, grouptype));
+dBase_c *dBase_c::createBase(ProfileName profName, dBase_c *parent, u32 param, u8 grouptype) {
+ return static_cast<dBase_c *>(fBase_c::createChild(profName, parent, param, grouptype));
}
-dBase_c* dBase_c::createRoot(ProfileName profName, unsigned long param, u8 groupType) {
- return static_cast<dBase_c*>(fBase_c::createRoot(profName, param, groupType));
+dBase_c *dBase_c::createRoot(ProfileName profName, u32 param, u8 groupType) {
+ return static_cast<dBase_c *>(fBase_c::createRoot(profName, param, groupType));
}
// dBase_c::~dBase_c() {}
diff --git a/src/egg/core/eggController.cpp b/src/egg/core/eggController.cpp
index fb359817..d6a4c4eb 100644
--- a/src/egg/core/eggController.cpp
+++ b/src/egg/core/eggController.cpp
@@ -1,10 +1,11 @@
#include "egg/core/eggController.h"
+#include "MSL_C/string.h"
#include "egg/core/eggAllocator.h"
#include "egg/core/eggExpHeap.h"
#include "egg/core/eggSystem.h"
-#include "MSL_C/string.h"
#include "rvl/VI.h"
+
EGG::NullController null_controller;
namespace EGG {
@@ -192,7 +193,7 @@ extern "C" void fn_803DB1E0(s32 channel, bool arg);
}
}
-extern "C" long lbl_80574EE8;
+extern "C" s32 lbl_80574EE8;
// TODO headers
extern "C" void fn_803D9400(void *a, void *b);
extern "C" void fn_803F2040(void *a, int b);
diff --git a/src/egg/core/eggHeap.cpp b/src/egg/core/eggHeap.cpp
index a7a0dc7a..49234e0d 100644
--- a/src/egg/core/eggHeap.cpp
+++ b/src/egg/core/eggHeap.cpp
@@ -38,13 +38,16 @@ namespace EGG {
OSUnlockMutex(&sRootMutex);
}
-/* 80495560 */ void *Heap::alloc(size_t size, s32 align, Heap *heap) {
+/* 80495560 */ void *Heap::alloc(size_t size, int align, Heap *heap) {
Heap *currentHeap = sCurrentHeap;
Thread *thread = Thread::findThread(OSGetCurrentThread());
Heap *threadHeap = nullptr;
- if (thread != nullptr && (threadHeap = thread->mAllocatableHeap, threadHeap != nullptr)) {
- heap = threadHeap;
+ if (thread != nullptr) {
+ threadHeap = thread->mAllocatableHeap;
+ if (threadHeap != nullptr) {
+ heap = threadHeap;
+ }
}
if (sAllocatableHeap != nullptr) {
if (heap == nullptr) {
diff --git a/src/egg/math/eggMatrix.cpp b/src/egg/math/eggMatrix.cpp
index 794cca7d..68f0049f 100644
--- a/src/egg/math/eggMatrix.cpp
+++ b/src/egg/math/eggMatrix.cpp
@@ -332,7 +332,7 @@ void Matrix34f::toQuat(Quatf &q) const {
q.multScalar(Math<f32>::inv(q.length()));
}
-void Matrix34f::slerpTo(const Matrix34f &m2, Matrix34f &out, f32 t) {
+void Matrix34f::slerpTo(const Matrix34f &m2, Matrix34f &out, f32 t) const {
Quatf q1, q2, q3;
m2.toQuat(q1);
toQuat(q2);
diff --git a/src/f/f_base.cpp b/src/f/f_base.cpp
index e7e6e1ab..661ec622 100644
--- a/src/f/f_base.cpp
+++ b/src/f/f_base.cpp
@@ -581,7 +581,7 @@ bool fBase_c::checkChildProcessCreateState() const {
}
/* 802e2540 */
-void fBase_c::setTmpCtData(ProfileName profile_name, fTrNdBa_c *connect_parent, unsigned long param, u8 group_type) {
+void fBase_c::setTmpCtData(ProfileName profile_name, fTrNdBa_c *connect_parent, u32 param, u8 group_type) {
m_tmpCtData.prof_name = profile_name;
m_tmpCtData.connect_parent = connect_parent;
m_tmpCtData.params = param;
@@ -589,7 +589,7 @@ void fBase_c::setTmpCtData(ProfileName profile_name, fTrNdBa_c *connect_parent,
}
/* 802e2560 */
-fBase_c *fBase_c::fBase_make(ProfileName profile_name, fTrNdBa_c *connect_parent, unsigned long param, u8 group_type) {
+fBase_c *fBase_c::fBase_make(ProfileName profile_name, fTrNdBa_c *connect_parent, u32 param, u8 group_type) {
if ((*fProfile::sProfileList)[profile_name] == nullptr) {
return nullptr;
}
@@ -608,7 +608,7 @@ fBase_c *fBase_c::fBase_make(ProfileName profile_name, fTrNdBa_c *connect_parent
}
/* 802e2600 */
-fBase_c *fBase_c::createChild(ProfileName profile_name, fBase_c *parent, unsigned long param, u8 group_type) {
+fBase_c *fBase_c::createChild(ProfileName profile_name, fBase_c *parent, u32 param, u8 group_type) {
if (parent == nullptr) {
return nullptr;
}
@@ -621,6 +621,6 @@ fBase_c *fBase_c::createChild(ProfileName profile_name, fBase_c *parent, unsigne
}
/* 802e2640 */
-fBase_c *fBase_c::createRoot(ProfileName profile_name, unsigned long param, u8 group_type) {
+fBase_c *fBase_c::createRoot(ProfileName profile_name, u32 param, u8 group_type) {
return fBase_make(profile_name, nullptr, param, group_type);
}
diff --git a/src/m/m_heap.cpp b/src/m/m_heap.cpp
index 2e9fd44c..6ab9cc12 100644
--- a/src/m/m_heap.cpp
+++ b/src/m/m_heap.cpp
@@ -3,20 +3,24 @@
#include <egg/core/eggFrmHeap.h>
#include <m/m_heap.h>
-namespace mHeap {
-
-u8 g_DefaultGameHeapId = 1;
+u8 mHeap::g_DefaultGameHeapId = 1;
#define MIN_ALIGN 0x20
-EGG::ExpHeap *g_gameHeaps[4];
-EGG::ExpHeap *s_SavedCurrentHeap;
-EGG::ExpHeap *g_archiveHeap;
-EGG::ExpHeap *g_commandHeap;
-EGG::ExpHeap *g_dylinkHeap;
-EGG::AssertHeap *g_assertHeap;
+EGG::Heap *mHeap::g_gameHeaps[4];
+EGG::Heap *mHeap::s_SavedCurrentHeap;
+EGG::Heap *mHeap::g_archiveHeap;
+EGG::Heap *mHeap::g_commandHeap;
+EGG::Heap *mHeap::g_dylinkHeap;
+EGG::AssertHeap *mHeap::g_assertHeap;
+const char *const mHeap::s_GameHeapNames[4] = {
+ 0,
+ "ゲーム用汎用ヒープ1(mHeap::gameHeaps[1])",
+ "ゲーム用汎用ヒープ2(mHeap::gameHeaps[2])",
+ 0,
+};
-u16 copyAttribute(u32 arg) {
+u16 mHeap::copyAttribute(u32 arg) {
u16 result = 0;
if ((arg & 1) != 0) {
@@ -31,13 +35,12 @@ u16 copyAttribute(u32 arg) {
return result;
}
-EGG::Heap *setCurrentHeap(EGG::Heap *heap) {
+EGG::Heap *mHeap::setCurrentHeap(EGG::Heap *heap) {
return heap->becomeCurrentHeap();
}
-EGG::ExpHeap *createExpHeap(size_t size, EGG::Heap *parent, const char *name, unsigned long align,
- unsigned long attrs) {
- if (parent == nullptr) {
- parent = EGG::Heap::sCurrentHeap;
+EGG::Heap *mHeap::createExpHeap(size_t size, EGG::Heap *parentHeap, const char *name, u32 align, u32 attrs) {
+ if (parentHeap == nullptr) {
+ parentHeap = EGG::Heap::sCurrentHeap;
}
if (align < MIN_ALIGN) {
@@ -47,15 +50,15 @@ EGG::ExpHeap *createExpHeap(size_t size, EGG::Heap *parent, const char *name, un
if (size != 0xFFFFFFFF) {
size = expHeapCost(size, align);
} else {
- size = parent->getAllocatableSize(align);
+ size = parentHeap->getAllocatableSize(align);
}
- void *mem = parent->alloc(size, align);
+ void *mem = parentHeap->alloc(size, align);
EGG::ExpHeap *heap = nullptr;
if (mem != nullptr) {
heap = EGG::ExpHeap::create(mem, size, copyAttribute(attrs));
if (heap == nullptr) {
- parent->free(mem);
+ parentHeap->free(mem);
} else if (name != nullptr) {
heap->mName = name;
}
@@ -63,7 +66,7 @@ EGG::ExpHeap *createExpHeap(size_t size, EGG::Heap *parent, const char *name, un
return heap;
}
-size_t adjustExpHeap(EGG::ExpHeap *heap) {
+size_t mHeap::adjustExpHeap(EGG::ExpHeap *heap) {
int ret = 0;
if (heap != nullptr) {
size_t ad = heap->adjust();
@@ -74,14 +77,14 @@ size_t adjustExpHeap(EGG::ExpHeap *heap) {
}
return ret;
}
-size_t expHeapCost(size_t size, s32 align) {
+size_t mHeap::expHeapCost(size_t size, u32 align) {
int a = align - 1;
- long b = (0x84 + a);
-
- return size + (~(a) & b);
+ s32 b = (0x84 + a);
+
+ return size + (~(a)&b);
}
-EGG::FrmHeap *createFrmHeap(size_t size, EGG::Heap *parent, const char *name, size_t align, size_t attrs) {
+EGG::FrmHeap *mHeap::createFrmHeap(size_t size, EGG::Heap *parent, const char *name, size_t align, size_t attrs) {
if (parent == nullptr) {
parent = EGG::Heap::sCurrentHeap;
}
@@ -108,13 +111,13 @@ EGG::FrmHeap *createFrmHeap(size_t size, EGG::Heap *parent, const char *name, si
}
return heap;
}
-void destroyFrmHeap(EGG::FrmHeap *heap) {
+void mHeap::destroyFrmHeap(EGG::FrmHeap *heap) {
if (heap != nullptr) {
heap->destroy();
}
}
-size_t adjustFrmHeap(EGG::FrmHeap *heap) {
+size_t mHeap::adjustFrmHeap(EGG::FrmHeap *heap) {
int ret = 0;
if (heap != nullptr) {
size_t ad = heap->adjust();
@@ -126,28 +129,22 @@ size_t adjustFrmHeap(EGG::FrmHeap *heap) {
return ret;
}
-size_t frmHeapCost(size_t size, s32 align) {
+size_t mHeap::frmHeapCost(size_t size, u32 align) {
int a = align - 1;
- long b = (0x7C + a);
-
- return size + (~(a) & b);
+ s32 b = (0x7C + a);
+
+ return size + (~(a)&b);
}
-EGG::Heap **setTempHeap(EGG::Heap **prevHeap, EGG::Heap *tempNewHeap) {
- *prevHeap = tempNewHeap->becomeCurrentHeap();
- return prevHeap;
+mHeap::mHeap(EGG::Heap *heap) {
+ this->heap = heap->becomeCurrentHeap();
}
-EGG::Heap **restoreTempHeap(EGG::Heap **prevHeap, s32 size) {
- if (prevHeap != nullptr) {
- (*prevHeap)->becomeCurrentHeap();
- if (size > 0) {
- delete prevHeap;
- }
- }
- return prevHeap;
+
+mHeap::~mHeap() {
+ heap->becomeCurrentHeap();
}
-EGG::ExpHeap *createHeap(size_t size, EGG::Heap *block, const char *name) {
+EGG::Heap *mHeap::createHeap(size_t size, EGG::Heap *block, const char *name) {
EGG::ExpHeap *heap = EGG::ExpHeap::create(size, block, 4);
if (heap != nullptr) {
heap->setGroupID(0);
@@ -160,73 +157,56 @@ EGG::ExpHeap *createHeap(size_t size, EGG::Heap *block, const char *name) {
return heap;
}
-void saveCurrentHeap() {
- s_SavedCurrentHeap = (EGG::ExpHeap *)EGG::Heap::sCurrentHeap;
+void mHeap::saveCurrentHeap() {
+ s_SavedCurrentHeap = EGG::Heap::sCurrentHeap;
}
-void restoreCurrentHeap() {
+void mHeap::restoreCurrentHeap() {
s_SavedCurrentHeap->becomeCurrentHeap();
s_SavedCurrentHeap = nullptr;
}
-EGG::FrmHeap *makeFrmHeapAndUpdate(size_t size, EGG::Heap *parentHeap, const char *name, s32 align, u32 unk) {
+EGG::FrmHeap *mHeap::makeFrmHeapAndUpdate(size_t size, EGG::Heap *parentHeap, const char *name, u32 align, u32 unk) {
EGG::FrmHeap *heap = createFrmHeap(size, parentHeap, name, align, unk);
if (heap != nullptr) {
- EGG::Heap *heap2 = setCurrentHeap(heap);
- s_SavedCurrentHeap = (EGG::ExpHeap *)heap2;
+ s_SavedCurrentHeap = setCurrentHeap(heap);
}
return heap;
}
-int getDefaultGameHeapId() {
+int mHeap::getDefaultGameHeapId() {
return g_DefaultGameHeapId;
}
-inline bool isValidHeapId(u32 id) {
- return id >= 1 && id <= 2;
-}
-
-const char *const s_GameHeapNames[4] = {
- 0,
- "ゲーム用汎用ヒープ1(mHeap::gameHeaps[1])",
- "ゲーム用汎用ヒープ2(mHeap::gameHeaps[2])",
- 0,
-};
-
-EGG::ExpHeap *createGameHeap(int heapId, size_t size, EGG::Heap *parent) {
+EGG::Heap *mHeap::createGameHeap(int heapId, size_t size, EGG::Heap *parent) {
if (!isValidHeapId(heapId)) {
return nullptr;
}
- g_gameHeaps[heapId] = createHeap(size, parent, s_GameHeapNames[heapId]);
+ g_gameHeaps[heapId] = mHeap::createHeap(size, parent, s_GameHeapNames[heapId]);
if (heapId == g_DefaultGameHeapId) {
g_gameHeaps[0] = g_gameHeaps[heapId];
}
return g_gameHeaps[heapId];
}
-EGG::ExpHeap *createGameHeap1(size_t size, EGG::Heap *parent) {
- return createGameHeap(getDefaultGameHeapId(), size, parent);
+void mHeap::createGameHeap1(size_t size, EGG::Heap *parentHeap) {
+ createGameHeap(getDefaultGameHeapId(), size, parentHeap);
}
-EGG::ExpHeap *createArchiveHeap(size_t size, EGG::Heap *parent) {
+void mHeap::createArchiveHeap(size_t size, EGG::Heap *parent) {
g_archiveHeap = createHeap(size, parent, "汎用ファイル読み込み用ヒープ(mHeap::archiveHeap)");
- return g_archiveHeap;
}
-EGG::ExpHeap *createCommandHeap(size_t size, EGG::Heap *parent) {
+void mHeap::createCommandHeap(size_t size, EGG::Heap *parent) {
g_commandHeap = createHeap(size, parent, "DVD読み込みコマンド用ヒープ(mHeap::commandHeap)");
- return g_commandHeap;
}
-EGG::ExpHeap *createDylinkHeap(size_t size, EGG::Heap *parent) {
+void mHeap::createDylinkHeap(size_t size, EGG::Heap *parent) {
g_dylinkHeap = createHeap(size, parent, "ダイナミックリンク用ヒープ(mHeap::dylinkHeap)");
- return g_dylinkHeap;
}
-EGG::AssertHeap *createAssertHeap(EGG::Heap *parent) {
+EGG::AssertHeap *mHeap::createAssertHeap(EGG::Heap *parent) {
const char *name = "アサートヒープ(mHeap::assertHeap)";
g_assertHeap = EGG::AssertHeap::create(EGG::AssertHeap::getSize(), parent);
g_assertHeap->mName = name;
return g_assertHeap;
}
-EGG::Heap *makeHeapOnCurrentGameHeap(size_t size, char *name, s32 align, u32 flags) {
+EGG::Heap *mHeap::makeHeapOnCurrentGameHeap(size_t size, const char *name, u32 align, u32 flags) {
return makeFrmHeapAndUpdate(size, g_gameHeaps[0], name, align, flags);
}
-
-} // namespace mHeap
diff --git a/src/nw4r/ut/ut_DvdFileStream.cpp b/src/nw4r/ut/ut_DvdFileStream.cpp
index 7e35ec14..8c7b2d8a 100644
--- a/src/nw4r/ut/ut_DvdFileStream.cpp
+++ b/src/nw4r/ut/ut_DvdFileStream.cpp
@@ -7,7 +7,7 @@ namespace ut {
NW4R_UT_RTTI_DEF_DERIVED(DvdFileStream, FileStream);
-void DvdFileStream::DvdAsyncCallback_(long result, DVDFileInfo *info) {
+void DvdFileStream::DvdAsyncCallback_(s32 result, DVDFileInfo *info) {
DvdFileStream *self = reinterpret_cast<AsyncContext *>(info)->stream;
self->mIsBusy = false;
@@ -18,7 +18,7 @@ void DvdFileStream::DvdAsyncCallback_(long result, DVDFileInfo *info) {
}
}
-void DvdFileStream::DvdCBAsyncCallback_(long result, DVDCommandBlock *block) {
+void DvdFileStream::DvdCBAsyncCallback_(s32 result, DVDCommandBlock *block) {
DvdFileStream *self = reinterpret_cast<AsyncContext *>(block)->stream;
self->mIsCancelling = false;
@@ -43,7 +43,7 @@ void DvdFileStream::Initialize_() {
mAsyncContext.stream = this;
}
-DvdFileStream::DvdFileStream(long entrynum) {
+DvdFileStream::DvdFileStream(s32 entrynum) {
Initialize_();
Open(entrynum);
}
@@ -101,10 +101,10 @@ void DvdFileStream::Close() {
}
}
-long DvdFileStream::Read(void *dst, unsigned long size) {
+s32 DvdFileStream::Read(void *dst, u32 size) {
size = AdjustReadLength_(size);
- long result = DVDReadPrio(&mAsyncContext.info, dst, size, mFilePosition.Tell(), mPriority);
+ s32 result = DVDReadPrio(&mAsyncContext.info, dst, size, mFilePosition.Tell(), mPriority);
if (result > 0) {
mFilePosition.Skip(result);
@@ -113,7 +113,7 @@ long DvdFileStream::Read(void *dst, unsigned long size) {
return result;
}
-bool DvdFileStream::ReadAsync(void *dst, unsigned long size, AsyncCallback callback, void *arg) {
+bool DvdFileStream::ReadAsync(void *dst, u32 size, AsyncCallback callback, void *arg) {
size = AdjustReadLength_(size);
bool success = DvdFileStream::PeekAsync(dst, size, callback, arg);
@@ -127,13 +127,13 @@ bool DvdFileStream::ReadAsync(void *dst, unsigned long size, AsyncCallback callb
return success;
}
-long DvdFileStream::Peek(void *dst, unsigned long size) {
+s32 DvdFileStream::Peek(void *dst, u32 size) {
size = AdjustReadLength_(size);
return DVDReadPrio(&mAsyncContext.info, dst, size, mFilePosition.Tell(), mPriority);
}
-bool DvdFileStream::PeekAsync(void *dst, unsigned long size, AsyncCallback callback, void *arg) {
+bool DvdFileStream::PeekAsync(void *dst, u32 size, AsyncCallback callback, void *arg) {
mCallback = callback;
mCallbackArg = arg;
mIsBusy = true;
@@ -143,7 +143,7 @@ bool DvdFileStream::PeekAsync(void *dst, unsigned long size, AsyncCallback callb
return DVDReadAsyncPrio(&mAsyncContext.info, dst, size, mFilePosition.Tell(), DvdAsyncCallback_, mPriority);
}
-void DvdFileStream::Seek(long offset, unsigned long origin) {
+void DvdFileStream::Seek(s32 offset, u32 origin) {
mFilePosition.Seek(offset, origin);
}
@@ -164,7 +164,7 @@ bool DvdFileStream::CancelAsync(AsyncCallback callback, void *arg) {
return success;
}
-unsigned long DvdFileStream::AdjustReadLength_(unsigned long len) {
+u32 DvdFileStream::AdjustReadLength_(u32 len) {
u32 fileOffset = mFilePosition.Tell();
u32 fileSize = mFilePosition.GetFileSize();
diff --git a/src/nw4r/ut/ut_DvdLockedFileStream.cpp b/src/nw4r/ut/ut_DvdLockedFileStream.cpp
index 1bf703f7..20e84897 100644
--- a/src/nw4r/ut/ut_DvdLockedFileStream.cpp
+++ b/src/nw4r/ut/ut_DvdLockedFileStream.cpp
@@ -24,7 +24,7 @@ void DvdLockedFileStream::InitMutex_() {
OSRestoreInterrupts(enabled);
}
-DvdLockedFileStream::DvdLockedFileStream(long entrynum) : DvdFileStream(entrynum) {
+DvdLockedFileStream::DvdLockedFileStream(s32 entrynum) : DvdFileStream(entrynum) {
mCancelFlag = false;
InitMutex_();
}
@@ -41,20 +41,20 @@ void DvdLockedFileStream::Close() {
mCancelFlag = false;
}
-long DvdLockedFileStream::Read(void *dst, unsigned long size) {
+s32 DvdLockedFileStream::Read(void *dst, u32 size) {
if (!LockMutex()) {
return DVD_RESULT_CANCELED;
}
- long ret = DvdFileStream::Read(dst, size);
+ s32 ret = DvdFileStream::Read(dst, size);
UnlockMutex();
return ret;
}
-long DvdLockedFileStream::Peek(void *dst, unsigned long size) {
+s32 DvdLockedFileStream::Peek(void *dst, u32 size) {
if (!LockMutex()) {
return DVD_RESULT_CANCELED;
}
- long ret = DvdFileStream::Peek(dst, size);
+ s32 ret = DvdFileStream::Peek(dst, size);
UnlockMutex();
return ret;
}
diff --git a/src/nw4r/ut/ut_FileStream.cpp b/src/nw4r/ut/ut_FileStream.cpp
index bec64b31..e7329a50 100644
--- a/src/nw4r/ut/ut_FileStream.cpp
+++ b/src/nw4r/ut/ut_FileStream.cpp
@@ -15,7 +15,7 @@ bool FileStream::CancelAsync(AsyncCallback callback, void *arg) {
return true;
}
-u32 FileStream::FilePosition::Skip(long offset) {
+u32 FileStream::FilePosition::Skip(s32 offset) {
if (offset != 0) {
s64 newOffset = mFileOffset + offset;
mFileOffset = Clamp<s64>(newOffset, 0, mFileSize);
@@ -24,7 +24,7 @@ u32 FileStream::FilePosition::Skip(long offset) {
return mFileOffset;
}
-u32 FileStream::FilePosition::Append(long offset) {
+u32 FileStream::FilePosition::Append(s32 offset) {
s64 newOffset = mFileOffset + offset;
if (newOffset < 0) {
@@ -37,7 +37,7 @@ u32 FileStream::FilePosition::Append(long offset) {
return mFileOffset;
}
-void FileStream::FilePosition::Seek(long offset, unsigned long origin) {
+void FileStream::FilePosition::Seek(s32 offset, u32 origin) {
switch (origin) {
case SEEK_BEG:
mFileOffset = 0;
diff --git a/src/nw4r/ut/ut_IOStream.cpp b/src/nw4r/ut/ut_IOStream.cpp
index 32d21799..91d37c83 100644
--- a/src/nw4r/ut/ut_IOStream.cpp
+++ b/src/nw4r/ut/ut_IOStream.cpp
@@ -7,15 +7,15 @@ namespace ut {
NW4R_UT_RTTI_DEF_BASE(IOStream);
-bool IOStream::ReadAsync(void *dst, unsigned long size, AsyncCallback callback, void *arg) {
+bool IOStream::ReadAsync(void *dst, u32 size, AsyncCallback callback, void *arg) {
return false;
}
-long IOStream::Write(const void *src, unsigned long size) {
+s32 IOStream::Write(const void *src, u32 size) {
return false;
}
-bool IOStream::WriteAsync(const void *src, unsigned long size, AsyncCallback callback, void *arg) {
+bool IOStream::WriteAsync(const void *src, u32 size, AsyncCallback callback, void *arg) {
return false;
}
diff --git a/src/nw4r/ut/ut_LockedCache.cpp b/src/nw4r/ut/ut_LockedCache.cpp
index f3f7e9d5..7db98a98 100644
--- a/src/nw4r/ut/ut_LockedCache.cpp
+++ b/src/nw4r/ut/ut_LockedCache.cpp
@@ -89,15 +89,15 @@ void Unlock() {
sLCImpl.Unlock();
}
-void LoadBlocks(void *dst, void *src, unsigned long size) {
+void LoadBlocks(void *dst, void *src, u32 size) {
LCLoadBlocks(dst, src, size);
}
-void StoreBlocks(void *dst, void *src, unsigned long size) {
+void StoreBlocks(void *dst, void *src, u32 size) {
LCStoreBlocks(dst, src, size);
}
-void StoreData(void *dst, void *src, unsigned long size) {
+void StoreData(void *dst, void *src, u32 size) {
LCStoreData(dst, src, size);
}
diff --git a/src/nw4r/ut/ut_NandFileStream.cpp b/src/nw4r/ut/ut_NandFileStream.cpp
index ae2f7422..118e2941 100644
--- a/src/nw4r/ut/ut_NandFileStream.cpp
+++ b/src/nw4r/ut/ut_NandFileStream.cpp
@@ -8,7 +8,7 @@ namespace ut {
NW4R_UT_RTTI_DEF_DERIVED(NandFileStream, FileStream);
-void NandFileStream::NandAsyncCallback_(long result, NANDCommandBlock *block) {
+void NandFileStream::NandAsyncCallback_(s32 result, NANDCommandBlock *block) {
NandFileStream *self = reinterpret_cast<AsyncContext *>(block)->stream;
self->mIsBusy = false;
@@ -32,12 +32,12 @@ void NandFileStream::Initialize_() {
mAsyncContext.stream = this;
}
-NandFileStream::NandFileStream(const char *path, unsigned long access) {
+NandFileStream::NandFileStream(const char *path, u32 access) {
Initialize_();
Open(path, access);
}
-NandFileStream::NandFileStream(const NANDFileInfo *info, unsigned long access, bool close) {
+NandFileStream::NandFileStream(const NANDFileInfo *info, u32 access, bool close) {
Initialize_();
Open(info, access, close);
}
@@ -48,7 +48,7 @@ NandFileStream::~NandFileStream() {
}
}
-bool NandFileStream::Open(const char *path, unsigned long access) {
+bool NandFileStream::Open(const char *path, u32 access) {
if (mCloseOnDestroy) {
Close();
}
@@ -61,7 +61,7 @@ bool NandFileStream::Open(const char *path, unsigned long access) {
}
if (mCanRead) {
- unsigned long fileSize;
+ u32 fileSize;
if (NANDGetLength(&mAsyncContext.info, &fileSize) != NAND_RESULT_OK) {
NANDClose(&mAsyncContext.info);
@@ -80,7 +80,7 @@ bool NandFileStream::Open(const char *path, unsigned long access) {
return true;
}
-bool NandFileStream::Open(const NANDFileInfo *info, unsigned long access, bool close) {
+bool NandFileStream::Open(const NANDFileInfo *info, u32 access, bool close) {
if (mCloseOnDestroy) {
Close();
}
@@ -90,7 +90,7 @@ bool NandFileStream::Open(const NANDFileInfo *info, unsigned long access, bool c
mAsyncContext.info = *info;
- unsigned long fileSize;
+ u32 fileSize;
if (mCanRead) {
if (NANDGetLength(&mAsyncContext.info, &fileSize) != NAND_RESULT_OK) {
if (close) {
@@ -115,10 +115,10 @@ void NandFileStream::Close() {
}
}
-long NandFileStream::Read(void *dst, unsigned long size) {
+s32 NandFileStream::Read(void *dst, u32 size) {
NANDSeek(&mAsyncContext.info, mFilePosition.Tell(), NAND_SEEK_BEG);
- long result = NANDRead(&mAsyncContext.info, dst, size);
+ s32 result = NANDRead(&mAsyncContext.info, dst, size);
if (result > 0) {
mFilePosition.Skip(result);
}
@@ -126,7 +126,7 @@ long NandFileStream::Read(void *dst, unsigned long size) {
return result;
}
-bool NandFileStream::ReadAsync(void *dst, unsigned long size, AsyncCallback callback, void *arg) {
+bool NandFileStream::ReadAsync(void *dst, u32 size, AsyncCallback callback, void *arg) {
mCallback = callback;
mCallbackArg = arg;
mIsBusy = true;
@@ -145,23 +145,23 @@ bool NandFileStream::ReadAsync(void *dst, unsigned long size, AsyncCallback call
return success;
}
-long NandFileStream::Write(const void *src, unsigned long size) {
+s32 NandFileStream::Write(const void *src, u32 size) {
NANDSeek(&mAsyncContext.info, mFilePosition.Tell(), NAND_SEEK_BEG);
- long result = NANDWrite(&mAsyncContext.info, src, size);
+ s32 result = NANDWrite(&mAsyncContext.info, src, size);
if (result > 0) {
mFilePosition.Append(result);
}
return result;
}
-bool NandFileStream::WriteAsync(const void *src, unsigned long size, AsyncCallback callback, void *arg) {
+bool NandFileStream::WriteAsync(const void *src, u32 size, AsyncCallback callback, void *arg) {
mCallback = callback;
mCallbackArg = arg;
mIsBusy = true;
NANDSeek(&mAsyncContext.info, mFilePosition.Tell(), NAND_SEEK_BEG);
- long result = NANDWriteAsync(&mAsyncContext.info, src, size, NandAsyncCallback_, &mAsyncContext.block);
+ s32 result = NANDWriteAsync(&mAsyncContext.info, src, size, NandAsyncCallback_, &mAsyncContext.block);
if (result == NAND_RESULT_OK) {
mFilePosition.Append(size);
@@ -172,7 +172,7 @@ bool NandFileStream::WriteAsync(const void *src, unsigned long size, AsyncCallba
return result == NAND_RESULT_OK;
}
-void NandFileStream::Seek(long offset, unsigned long origin) {
+void NandFileStream::Seek(s32 offset, u32 origin) {
mFilePosition.Seek(offset, origin);
}
diff --git a/src/nw4r/ut/ut_binaryFileFormat.cpp b/src/nw4r/ut/ut_binaryFileFormat.cpp
index 1b62b51c..cde48e24 100644
--- a/src/nw4r/ut/ut_binaryFileFormat.cpp
+++ b/src/nw4r/ut/ut_binaryFileFormat.cpp
@@ -4,7 +4,7 @@ namespace nw4r {
namespace ut {
/* 8042a9e0 */
-bool IsValidBinaryFile(const BinaryFileHeader *header, unsigned long magic, u16 version, u16 numBlocks) {
+bool IsValidBinaryFile(const BinaryFileHeader *header, u32 magic, u16 version, u16 numBlocks) {
if (header->magic != magic) {
return false;
}