mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-21 11:39:10 +00:00
65
src/Kyoto/CARAMToken.cpp
Normal file
65
src/Kyoto/CARAMToken.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "Kyoto/CARAMToken.hpp"
|
||||
|
||||
#include "Kyoto/Alloc/CMemorySys.hpp"
|
||||
#include "Kyoto/CARAMManager.hpp"
|
||||
|
||||
#include "rstl/construct.hpp"
|
||||
|
||||
CARAMToken::CARAMToken() {
|
||||
x0_ = 6;
|
||||
x4_ = NULL;
|
||||
x8_ = CARAMManager::GetInvalidAlloc();
|
||||
xc_ = 0;
|
||||
x10_ = CARAMManager::GetInvalidDMAHandle();
|
||||
x14_ = 0;
|
||||
x18_ = 0;
|
||||
x1c_24_ = false;
|
||||
InitiallyMoveToList();
|
||||
}
|
||||
|
||||
CARAMToken::CARAMToken(void* ptr, uint len) {}
|
||||
|
||||
CARAMToken::CARAMToken(const CARAMToken& other)
|
||||
: x0_(other.x0_)
|
||||
, x4_(other.x4_)
|
||||
, x8_(other.x8_)
|
||||
, xc_(other.xc_)
|
||||
, x10_(other.x10_)
|
||||
, x14_(0)
|
||||
, x18_(0)
|
||||
, x1c_24_(other.x1c_24_) {
|
||||
const_cast< CARAMToken& >(other).MakeInvalid();
|
||||
InitiallyMoveToList();
|
||||
}
|
||||
|
||||
CARAMToken::~CARAMToken() {
|
||||
if (x10_ != CARAMManager::GetInvalidDMAHandle() && !CARAMManager::CancelDMA(x10_)) {
|
||||
CARAMManager::WaitForDMACompletion(x10_);
|
||||
}
|
||||
|
||||
RemoveFromList();
|
||||
CMemory::Free(x4_);
|
||||
CARAMManager::Free(x8_);
|
||||
}
|
||||
|
||||
void CARAMToken::PostConstruct(void* ptr, uint len, int unk) {
|
||||
MoveToList(kS_One);
|
||||
x4_ = ptr;
|
||||
xc_ = len;
|
||||
x1c_24_ = unk == 0;
|
||||
}
|
||||
|
||||
CARAMToken& CARAMToken::operator=(const CARAMToken& other) {
|
||||
if (&other == this) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
rstl::destroy(this);
|
||||
rstl::construct(this, other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void CARAMToken::LoadToMRAM() {
|
||||
|
||||
}
|
||||
75
src/Kyoto/Graphics/DolphinCTexture.cpp
Normal file
75
src/Kyoto/Graphics/DolphinCTexture.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#include "Kyoto/Graphics/CTexture.hpp"
|
||||
|
||||
#include "Kyoto/CDvdRequest.hpp"
|
||||
#include "Kyoto/Graphics/CGraphicsPalette.hpp"
|
||||
#include "Kyoto/Alloc/CMemorySys.hpp"
|
||||
|
||||
int CTexture::sCurrentFrameCount = 0;
|
||||
int CTexture::sTotalAllocatedMemory = 0;
|
||||
bool CTexture::sMangleMips = false;
|
||||
|
||||
static CTexture* sLoadedTextures[GX_MAX_TEXMAP];
|
||||
|
||||
CTexture::CTexture(ETexelFormat fmt, short w, short h, int mips)
|
||||
: mTexelFormat(fmt)
|
||||
, mWidth(w)
|
||||
, mHeight(h)
|
||||
, mNumMips(mips)
|
||||
, mBitsPerPixel(TexelFormatBitsPerPixel(fmt))
|
||||
, mLocked(false)
|
||||
, mCanLoadPalette(false)
|
||||
, mIsPowerOfTwo(false)
|
||||
, mNoSwap(true)
|
||||
, mCounted(false)
|
||||
, mCanLoadObj(false)
|
||||
, mMemoryAllocated(0)
|
||||
, mFrameAllocated(sCurrentFrameCount)
|
||||
, mNativeFormat(GX_TF_RGB565)
|
||||
, mNativeCIFormat(GX_TF_C8)
|
||||
, mClampMode(kCM_Repeat) {
|
||||
InitBitmapBuffers(fmt, w, h, mips);
|
||||
InitTextureObjects();
|
||||
}
|
||||
|
||||
CTexture::CTexture(CInputStream& in, EAutoMipmap automip, EBlackKey blackKey) {
|
||||
|
||||
}
|
||||
|
||||
CTexture::~CTexture() {
|
||||
UncountMemory();
|
||||
}
|
||||
|
||||
|
||||
void CTexture::MakeSwappable() const {
|
||||
if (!mNoSwap) {
|
||||
return;
|
||||
}
|
||||
|
||||
mNoSwap = false;
|
||||
}
|
||||
void CTexture::CountMemory() const {
|
||||
if (mCounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCounted = true;
|
||||
sTotalAllocatedMemory += mMemoryAllocated;
|
||||
}
|
||||
|
||||
|
||||
void CTexture::UncountMemory() const {
|
||||
if (!mCounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCounted = false;
|
||||
sTotalAllocatedMemory -= mMemoryAllocated;
|
||||
}
|
||||
|
||||
void CTexture::InvalidateTexmap(GXTexMapID texmap) {
|
||||
sLoadedTextures[texmap] = nullptr;
|
||||
}
|
||||
|
||||
void CTexture::sub_8030e10c() {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user