diff --git a/src/client/ClientServices.cpp b/src/client/ClientServices.cpp index 8972f1b..9ac249b 100644 --- a/src/client/ClientServices.cpp +++ b/src/client/ClientServices.cpp @@ -25,8 +25,8 @@ ClientServices* ClientServices::GetInstance() { return ClientServices::s_instance; } - auto instanceMem = SMemAlloc(sizeof(ClientServices), __FILE__, __LINE__, 0x0); - auto instance = new (instanceMem) ClientServices(); + auto m = SMemAlloc(sizeof(ClientServices), __FILE__, __LINE__, 0x0); + auto instance = new (m) ClientServices(); ClientServices::s_instance = instance; return ClientServices::s_instance; diff --git a/src/event/Queue.cpp b/src/event/Queue.cpp index 74d4735..6dd4175 100644 --- a/src/event/Queue.cpp +++ b/src/event/Queue.cpp @@ -49,15 +49,8 @@ void IEvtQueueRegister(EvtContext* context, EVENTID id, int32_t (*handler)(const auto handlerList = &context->m_queueHandlerList[id]; - EvtHandler* evtHandler; - - void* m = SMemAlloc(sizeof(EvtHandler), __FILE__, __LINE__, 0x8); - - if (m) { - evtHandler = new (m) EvtHandler(); - } else { - evtHandler = nullptr; - } + auto m = SMemAlloc(sizeof(EvtHandler), __FILE__, __LINE__, 0x8); + auto evtHandler = new (m) EvtHandler(); evtHandler->priority = priority; evtHandler->param = param; diff --git a/src/event/Scheduler.cpp b/src/event/Scheduler.cpp index b3e461c..3f3f4f0 100644 --- a/src/event/Scheduler.cpp +++ b/src/event/Scheduler.cpp @@ -37,21 +37,14 @@ HEVENTCONTEXT IEvtSchedulerCreateContext(int32_t interactive, int32_t (*initiali callContext = OsCallInitializeContext(contextName); } - void* m = SMemAlloc(sizeof(EvtContext), __FILE__, __LINE__, 0); - - EvtContext* context; - - if (m) { - context = new (m) EvtContext( - interactive != 0 ? 2 : 0, - idleTime, - interactive != 0 ? 1000 : 1, - callContext, - (debugFlags >> 1) & 1 - ); - } else { - context = nullptr; - } + auto m = SMemAlloc(sizeof(EvtContext), __FILE__, __LINE__, 0x0); + auto context = new (m) EvtContext( + interactive != 0 ? 2 : 0, + idleTime, + interactive != 0 ? 1000 : 1, + callContext, + (debugFlags >> 1) & 1 + ); if (interactive) { SInterlockedIncrement(&Event::s_interactiveCount); @@ -89,13 +82,8 @@ void IEvtSchedulerInitialize(int32_t threadCount, int32_t netServer) { // Allocate SCritSects for each thread slot int32_t v4 = sizeof(SCritSect) * threadSlotCount; - void* v5 = SMemAlloc((v4 + 4), ".\\EvtSched.cpp", 791, 0); - - if (v5) { - Event::s_threadSlotCritsects = new (v5) SCritSect[threadSlotCount]; - } else { - Event::s_threadSlotCritsects = nullptr; - } + auto slotMem = SMemAlloc((v4 + 4), __FILE__, __LINE__, 0x0); + Event::s_threadSlotCritsects = new (slotMem) SCritSect[threadSlotCount]; // Allocate EvtThread pointers for each thread slot Event::s_threadSlots = static_cast(SMemAlloc(sizeof(EvtThread*) * threadSlotCount, __FILE__, __LINE__, 0)); @@ -107,15 +95,8 @@ void IEvtSchedulerInitialize(int32_t threadCount, int32_t netServer) { Event::s_mainThread = InitializeSchedulerThread(); for (int32_t i = 0; i < threadCount - 1; ++i) { - void* m = SMemAlloc(sizeof(SThread), __FILE__, __LINE__, 0); - - SThread* thread; - - if (m) { - thread = new (m) SThread(); - } else { - thread = nullptr; - } + auto threadMem = SMemAlloc(sizeof(SThread), __FILE__, __LINE__, 0x0); + auto thread = new (threadMem) SThread(); Event::s_schedulerThreads.SetCount(Event::s_schedulerThreads.Count() + 1); diff --git a/src/glue/CGlueMgr.cpp b/src/glue/CGlueMgr.cpp index bc415a7..59c81b3 100644 --- a/src/glue/CGlueMgr.cpp +++ b/src/glue/CGlueMgr.cpp @@ -248,15 +248,8 @@ void CGlueMgr::Resume() { CoordinateSetAspectRatio(CGlueMgr::m_aspect); // Create CSimpleTop - CSimpleTop* top; - - void* m = SMemAlloc(sizeof(CSimpleTop), __FILE__, __LINE__, 0); - - if (m) { - top = new (m) CSimpleTop(); - } else { - top = nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleTop), __FILE__, __LINE__, 0x0); + auto top = new (m) CSimpleTop(); CGlueMgr::m_simpleTop = top; CGlueMgr::m_simpleTop->m_displaySizeCallback = &CGlueMgr::HandleDisplaySizeChanged; diff --git a/src/gx/CGxDevice.cpp b/src/gx/CGxDevice.cpp index 510f4c3..e98a89e 100644 --- a/src/gx/CGxDevice.cpp +++ b/src/gx/CGxDevice.cpp @@ -82,25 +82,15 @@ CGxDevice* CGxDevice::NewD3d9Ex() { #if defined(WHOA_SYSTEM_MAC) CGxDevice* CGxDevice::NewGLL() { - void* m = SMemAlloc(sizeof(CGxDeviceGLL), __FILE__, __LINE__, 0); - - if (m) { - return new (m) CGxDeviceGLL(); - } else { - return nullptr; - } + auto m = SMemAlloc(sizeof(CGxDeviceGLL), __FILE__, __LINE__, 0x0); + return new (m) CGxDeviceGLL(); } #endif CGxDevice* CGxDevice::NewOpenGl() { // TODO - // void* m = SMemAlloc(sizeof(CGxDeviceOpenGl), __FILE__, __LINE__, 0); - - // if (m) { - // return new (m) CGxDeviceOpenGl(); - // } else { - // return nullptr; - // } + // auto m = SMemAlloc(sizeof(CGxDeviceOpenGl), __FILE__, __LINE__, 0x0); + // return new (m) CGxDeviceOpenGl(); return nullptr; } @@ -124,8 +114,8 @@ CGxDevice::CGxDevice() { } CGxBuf* CGxDevice::BufCreate(CGxPool* pool, uint32_t itemSize, uint32_t itemCount, uint32_t index) { - void* m = SMemAlloc(sizeof(CGxBuf), __FILE__, __LINE__, 0); - CGxBuf* buf = new (m) CGxBuf(pool, itemSize, itemCount, index); + auto m = SMemAlloc(sizeof(CGxBuf), __FILE__, __LINE__, 0x0); + auto buf = new (m) CGxBuf(pool, itemSize, itemCount, index); pool->m_bufList.LinkToTail(buf); @@ -636,8 +626,8 @@ void CGxDevice::PrimVertexPtr(CGxBuf* buf, EGxVertexBufferFormat format) { } CGxPool* CGxDevice::PoolCreate(EGxPoolTarget target, EGxPoolUsage usage, uint32_t size, EGxPoolHintBits hint, const char* name) { - void* m = SMemAlloc(sizeof(CGxPool), __FILE__, __LINE__, 0); - CGxPool* pool = new (m) CGxPool(target, usage, size, hint, name); + auto m = SMemAlloc(sizeof(CGxPool), __FILE__, __LINE__, 0x0); + auto pool = new (m) CGxPool(target, usage, size, hint, name); this->m_poolList.LinkToTail(pool); @@ -889,24 +879,19 @@ void CGxDevice::ShaderCreate(CGxShader* shaders[], EGxShTarget target, const cha } int32_t CGxDevice::TexCreate(EGxTexTarget target, uint32_t width, uint32_t height, uint32_t depth, EGxTexFormat format, EGxTexFormat dataFormat, CGxTexFlags flags, void* userArg, void (*userFunc)(EGxTexCommand, uint32_t, uint32_t, uint32_t, uint32_t, void*, uint32_t&, const void*&), const char* name, CGxTex*& texId) { - void* m = SMemAlloc(sizeof(CGxTex), __FILE__, __LINE__, 0); - - CGxTex* tex = nullptr; - - if (m) { - tex = new (m) CGxTex( - target, - width, - height, - depth, - format, - dataFormat, - flags, - userArg, - userFunc, - name - ); - } + auto m = SMemAlloc(sizeof(CGxTex), __FILE__, __LINE__, 0); + auto tex = new (m) CGxTex( + target, + width, + height, + depth, + format, + dataFormat, + flags, + userArg, + userFunc, + name + ); texId = tex; diff --git a/src/gx/Camera.cpp b/src/gx/Camera.cpp index 9a0a2da..f2a0fdf 100644 --- a/src/gx/Camera.cpp +++ b/src/gx/Camera.cpp @@ -6,7 +6,7 @@ #include HCAMERA CameraCreate() { - void* m = SMemAlloc(sizeof(CCamera), __FILE__, __LINE__, 0x0); + auto m = SMemAlloc(sizeof(CCamera), __FILE__, __LINE__, 0x0); auto camera = new (m) CCamera(); return HandleCreate(camera); } diff --git a/src/gx/Font.cpp b/src/gx/Font.cpp index 952f31f..c6542cf 100644 --- a/src/gx/Font.cpp +++ b/src/gx/Font.cpp @@ -247,7 +247,7 @@ CGxStringBatch* GxuFontCreateBatch(bool a1, bool a2) { batch = s_unusedBatches.Head(); s_unusedBatches.UnlinkNode(batch); } else { - void* m = SMemAlloc(sizeof(CGxStringBatch), __FILE__, __LINE__, 0x8); + auto m = SMemAlloc(sizeof(CGxStringBatch), __FILE__, __LINE__, 0x8); batch = new (m) CGxStringBatch(); } @@ -764,7 +764,7 @@ HTEXTBLOCK TextBlockCreate(HTEXTFONT font, const char* text, const CImVector& co STORM_ASSERT(font); STORM_ASSERT(text); - void* m = SMemAlloc(sizeof(TEXTBLOCK), __FILE__, __LINE__, 0x0); + auto m = SMemAlloc(sizeof(TEXTBLOCK), __FILE__, __LINE__, 0x0); auto textBlock = new (m) TEXTBLOCK(); C3Vector position = { 0.0f, 0.0f, pos.z }; diff --git a/src/gx/Screen.cpp b/src/gx/Screen.cpp index 68bcaa4..e9a4c10 100644 --- a/src/gx/Screen.cpp +++ b/src/gx/Screen.cpp @@ -185,9 +185,8 @@ void ScrnLayerCreate(const RECTF* rect, float zorder, unsigned long flags, void* const RECTF* r = rect ? rect : &defaultrect; - void* m = SMemAlloc(sizeof(CILayer), __FILE__, __LINE__, 0); - - CILayer* l = new (m) CILayer(); + auto m = SMemAlloc(sizeof(CILayer), __FILE__, __LINE__, 0x0); + auto l = new (m) CILayer(); l->rect.left = r->left; l->rect.bottom = r->bottom; diff --git a/src/gx/Texture.cpp b/src/gx/Texture.cpp index 35fdc7d..30378a2 100644 --- a/src/gx/Texture.cpp +++ b/src/gx/Texture.cpp @@ -744,13 +744,8 @@ CTexture* CreateBlpSync(int32_t createFlags, char* fileName, char* fileExt, CGxT return nullptr; } - void* v8 = SMemAlloc(sizeof(CTexture), "HTEXTURE", -2, 0); - - CTexture* texture; - - if (v8) { - texture = new (v8) CTexture(); - } + auto m = SMemAlloc(sizeof(CTexture), "HTEXTURE", -2, 0x0); + auto texture = new (m) CTexture(); texture->gxTexFlags = texFlags; @@ -945,8 +940,8 @@ HTEXTURE TextureCreate(uint32_t width, uint32_t height, EGxTexFormat format, EGx } HTEXTURE TextureCreate(EGxTexTarget target, uint32_t width, uint32_t height, uint32_t depth, EGxTexFormat format, EGxTexFormat dataFormat, CGxTexFlags texFlags, void* userArg, TEXTURE_CALLBACK* userFunc, const char* a10, int32_t a11) { - void* m = SMemAlloc(sizeof(CTexture), __FILE__, __LINE__, 0x0); - CTexture* texture = new (m) CTexture(); + auto m = SMemAlloc(sizeof(CTexture), __FILE__, __LINE__, 0x0); + auto texture = new (m) CTexture(); if (a11) { texFlags.m_filter = CTexture::s_filterMode; @@ -976,8 +971,8 @@ HTEXTURE TextureCreateSolid(const CImVector& color) { return textureHandle; } - void* m = SMemAlloc(sizeof(CTexture), __FILE__, __LINE__, 0x0); - CTexture* texture = new (m) CTexture(); + auto m = SMemAlloc(sizeof(CTexture), __FILE__, __LINE__, 0x0); + auto texture = new (m) CTexture(); FillInSolidTexture(color, texture); textureHandle = HandleCreate(texture); diff --git a/src/gx/font/CGxFont.cpp b/src/gx/font/CGxFont.cpp index 43ce140..b0ae63f 100644 --- a/src/gx/font/CGxFont.cpp +++ b/src/gx/font/CGxFont.cpp @@ -87,8 +87,8 @@ CHARCODEDESC* TEXTURECACHEROW::CreateNewDesc(GLYPHBITMAPDATA* data, uint32_t row this->widestFreeSlot = gapToPrevious; if (gapToPrevious >= glyphWidth) { - void* m = SMemAlloc(sizeof(CHARCODEDESC), __FILE__, __LINE__, 0); - CHARCODEDESC* newCode = new (m) CHARCODEDESC(); + auto m = SMemAlloc(sizeof(CHARCODEDESC), __FILE__, __LINE__, 0x0); + auto newCode = new (m) CHARCODEDESC(); this->glyphList.LinkNode(newCode, 2, this->glyphList.Head()); @@ -127,7 +127,7 @@ CHARCODEDESC* TEXTURECACHEROW::CreateNewDesc(GLYPHBITMAPDATA* data, uint32_t row } if (gapToNext >= glyphWidth) { - void* m = SMemAlloc(sizeof(CHARCODEDESC), __FILE__, __LINE__, 0); + auto m = SMemAlloc(sizeof(CHARCODEDESC), __FILE__, __LINE__, 0x0); newCode = new (m) CHARCODEDESC(); this->glyphList.LinkNode(newCode, 1, code); diff --git a/src/gx/font/CGxString.cpp b/src/gx/font/CGxString.cpp index 92f9ba0..b46a8fb 100644 --- a/src/gx/font/CGxString.cpp +++ b/src/gx/font/CGxString.cpp @@ -15,7 +15,7 @@ TEXTLINETEXTURE* TEXTLINETEXTURE::NewTextLineTexture() { // TODO // Allocate off of TEXTLINETEXTURE::s_freeTextLineTextures - void* m = SMemAlloc(sizeof(TEXTLINETEXTURE), __FILE__, __LINE__, 0x0); + auto m = SMemAlloc(sizeof(TEXTLINETEXTURE), __FILE__, __LINE__, 0x0); return new (m) TEXTLINETEXTURE(); } @@ -118,7 +118,7 @@ CGxString* CGxString::GetNewString(int32_t linkOnList) { return string; } - void* m = SMemAlloc(sizeof(CGxString), __FILE__, __LINE__, 0x8); + auto m = SMemAlloc(sizeof(CGxString), __FILE__, __LINE__, 0x8); string = new (m) CGxString(); if (linkOnList) { diff --git a/src/model/CM2Cache.cpp b/src/model/CM2Cache.cpp index 2e45beb..abd8b63 100644 --- a/src/model/CM2Cache.cpp +++ b/src/model/CM2Cache.cpp @@ -36,8 +36,8 @@ CM2Shared* CM2Cache::CreateShared(const char* path, uint32_t flags) { SFile* fileptr; if (SFile::OpenEx(nullptr, convertedPath, (flags >> 2) & 1, &fileptr)) { - void* m = SMemAlloc(sizeof(CM2Shared), __FILE__, __LINE__, 0x0); - CM2Shared* shared = new (m) CM2Shared(this); + auto m = SMemAlloc(sizeof(CM2Shared), __FILE__, __LINE__, 0x0); + auto shared = new (m) CM2Shared(this); if (shared->Load(fileptr, flags & 0x4, &v28)) { strcpy(shared->m_filePath, convertedPath); diff --git a/src/model/Model2.cpp b/src/model/Model2.cpp index fd4356a..c29be2c 100644 --- a/src/model/Model2.cpp +++ b/src/model/Model2.cpp @@ -116,7 +116,7 @@ int32_t M2ConvertModelFileName(const char* source, char* dest, uint32_t a3, uint } CM2Scene* M2CreateScene() { - void* m = SMemAlloc(sizeof(CM2Scene), __FILE__, __LINE__, 0x0); + auto m = SMemAlloc(sizeof(CM2Scene), __FILE__, __LINE__, 0x0); return new (m) CM2Scene(&CM2Cache::s_cache); } diff --git a/src/ui/CBackdropGenerator.cpp b/src/ui/CBackdropGenerator.cpp index a176c9e..b586081 100644 --- a/src/ui/CBackdropGenerator.cpp +++ b/src/ui/CBackdropGenerator.cpp @@ -166,8 +166,8 @@ void CBackdropGenerator::SetOutput(CSimpleFrame* frame) { // TODO // CSimpleTexture* backgroundTexture = CSimpleTexture::s_allocator.GetData(0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); - CSimpleTexture* backgroundTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND, 1); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto backgroundTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND, 1); this->m_backgroundTexture = backgroundTexture; @@ -185,8 +185,8 @@ void CBackdropGenerator::SetOutput(CSimpleFrame* frame) { // TODO // CSimpleTexture* leftTexture = CSimpleTexture::s_allocator.GetData(0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); - CSimpleTexture* leftTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto leftTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); this->m_leftTexture = leftTexture; @@ -204,8 +204,8 @@ void CBackdropGenerator::SetOutput(CSimpleFrame* frame) { // TODO // CSimpleTexture* rightTexture = CSimpleTexture::s_allocator.GetData(0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); - CSimpleTexture* rightTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto rightTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); this->m_rightTexture = rightTexture; @@ -223,8 +223,8 @@ void CBackdropGenerator::SetOutput(CSimpleFrame* frame) { // TODO // CSimpleTexture* topTexture = CSimpleTexture::s_allocator.GetData(0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); - CSimpleTexture* topTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto topTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); this->m_topTexture = topTexture; @@ -242,8 +242,8 @@ void CBackdropGenerator::SetOutput(CSimpleFrame* frame) { // TODO // CSimpleTexture* bottomTexture = CSimpleTexture::s_allocator.GetData(0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); - CSimpleTexture* bottomTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto bottomTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); this->m_bottomTexture = bottomTexture; @@ -261,8 +261,8 @@ void CBackdropGenerator::SetOutput(CSimpleFrame* frame) { // TODO // CSimpleTexture* topLeftTexture = CSimpleTexture::s_allocator.GetData(0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); - CSimpleTexture* topLeftTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto topLeftTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); this->m_topLeftTexture = topLeftTexture; @@ -284,8 +284,8 @@ void CBackdropGenerator::SetOutput(CSimpleFrame* frame) { // TODO // CSimpleTexture* topRightTexture = CSimpleTexture::s_allocator.GetData(0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); - CSimpleTexture* topRightTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto topRightTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); this->m_topRightTexture = topRightTexture; @@ -307,8 +307,8 @@ void CBackdropGenerator::SetOutput(CSimpleFrame* frame) { // TODO // CSimpleTexture* bottomLeftTexture = CSimpleTexture::s_allocator.GetData(0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); - CSimpleTexture* bottomLeftTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto bottomLeftTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); this->m_bottomLeftTexture = bottomLeftTexture; @@ -330,8 +330,8 @@ void CBackdropGenerator::SetOutput(CSimpleFrame* frame) { // TODO // CSimpleTexture* bottomRightTexture = CSimpleTexture::s_allocator.GetData(0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); - CSimpleTexture* bottomRightTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto bottomRightTexture = new (m) CSimpleTexture(frame, DRAWLAYER_BACKGROUND_BORDER, 1); this->m_bottomRightTexture = bottomRightTexture; diff --git a/src/ui/CFrameStrata.cpp b/src/ui/CFrameStrata.cpp index 432f04e..c9d1fbc 100644 --- a/src/ui/CFrameStrata.cpp +++ b/src/ui/CFrameStrata.cpp @@ -80,8 +80,8 @@ void CFrameStrata::AddFrame(CSimpleFrame* frame) { this->levels.SetCount(frame->m_level + 1); for (int32_t i = count; i < frame->m_level + 1; i++) { - void* m = SMemAlloc(sizeof(CFrameStrataNode), __FILE__, __LINE__, 0); - CFrameStrataNode* node = m ? new (m) CFrameStrataNode() : nullptr; + auto m = SMemAlloc(sizeof(CFrameStrataNode), __FILE__, __LINE__, 0x0); + auto node = new (m) CFrameStrataNode(); this->levels[i] = node; } } diff --git a/src/ui/CLayoutFrame.cpp b/src/ui/CLayoutFrame.cpp index 9074488..dcfb8f5 100644 --- a/src/ui/CLayoutFrame.cpp +++ b/src/ui/CLayoutFrame.cpp @@ -692,8 +692,8 @@ void CLayoutFrame::SetAllPoints(CLayoutFrame* relative, int32_t doResize) { // TODO // CFramePoint::s_framePointHeap->GetData(0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CFramePoint), __FILE__, __LINE__, 0); - topLeft = m ? new (m) CFramePoint(relative, FRAMEPOINT_TOPLEFT, 0.0f, 0.0f) : nullptr; + auto m = SMemAlloc(sizeof(CFramePoint), __FILE__, __LINE__, 0x0); + topLeft = new (m) CFramePoint(relative, FRAMEPOINT_TOPLEFT, 0.0f, 0.0f); this->m_points[FRAMEPOINT_TOPLEFT] = topLeft; } @@ -707,7 +707,7 @@ void CLayoutFrame::SetAllPoints(CLayoutFrame* relative, int32_t doResize) { // CFramePoint::s_framePointHeap->GetData(0, __FILE__, __LINE__); void* m = SMemAlloc(sizeof(CFramePoint), __FILE__, __LINE__, 0); - bottomRight = m ? new (m) CFramePoint(relative, FRAMEPOINT_BOTTOMRIGHT, 0.0f, 0.0f) : nullptr; + bottomRight = new (m) CFramePoint(relative, FRAMEPOINT_BOTTOMRIGHT, 0.0f, 0.0f); this->m_points[FRAMEPOINT_BOTTOMRIGHT] = bottomRight; } @@ -798,7 +798,8 @@ void CLayoutFrame::SetPoint(FRAMEPOINT point, CLayoutFrame* relative, FRAMEPOINT // CFramePoint::s_framePointHeap->GetData(0, __FILE__, __LINE__); void* m = SMemAlloc(sizeof(CFramePoint), __FILE__, __LINE__, 0); - framePoint = m ? new (m) CFramePoint(relative, relativePoint, offsetX, offsetY) : nullptr; + framePoint = new (m) CFramePoint(relative, relativePoint, offsetX, offsetY); + this->m_points[point] = framePoint; } diff --git a/src/ui/CSimpleButton.cpp b/src/ui/CSimpleButton.cpp index 527e1a1..563fb8f 100644 --- a/src/ui/CSimpleButton.cpp +++ b/src/ui/CSimpleButton.cpp @@ -459,8 +459,8 @@ int32_t CSimpleButton::SetHighlight(const char* texFile, EGxBlend blendMode) { return 1; } - // TODO void* m = CDataAllocator::GetData(CSimpleTexture::s_allocator, 0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + // TODO auto m = CDataAllocator::GetData(CSimpleTexture::s_allocator, 0, __FILE__, __LINE__); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); auto texture = new (m) CSimpleTexture(this, DRAWLAYER_HIGHLIGHT, 1); if (!texture->SetTexture(texFile, false, false, CSimpleTexture::s_textureFilterMode, ImageMode_UI)) { @@ -556,7 +556,7 @@ int32_t CSimpleButton::SetStateTexture(CSimpleButtonState state, const char* tex } // TODO void* m = CDataAllocator::GetData(CSimpleTexture::s_allocator, 0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); auto texture = new (m) CSimpleTexture(nullptr, 2, 1); if (texture->SetTexture(texFile, false, false, CSimpleTexture::s_textureFilterMode, ImageMode_UI)) { @@ -577,17 +577,10 @@ void CSimpleButton::SetText(const char* string) { if ((string && *string) || this->m_text) { if (!this->m_text) { // TODO - // void* m = CDataAllocator::GetData(CSimpleFontString::s_allocator, 0, __FILE__, __LINE__); + // auto m = CDataAllocator::GetData(CSimpleFontString::s_allocator, 0, __FILE__, __LINE__); - void* m = SMemAlloc(sizeof(CSimpleFontString), __FILE__, __LINE__, 0x0); - - CSimpleFontString* text; - - if (m) { - text = new (m) CSimpleFontString(this, 2, 1); - } else { - text = nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleFontString), __FILE__, __LINE__, 0x0); + auto text = new (m) CSimpleFontString(this, 2, 1); this->SetFontString(text); } diff --git a/src/ui/CSimpleEditBox.cpp b/src/ui/CSimpleEditBox.cpp index 028f037..6945ce9 100644 --- a/src/ui/CSimpleEditBox.cpp +++ b/src/ui/CSimpleEditBox.cpp @@ -95,16 +95,16 @@ CSimpleEditBox::CSimpleEditBox(CSimpleFrame* parent) : CSimpleFrame(parent) { memset(textInfo, 0, sizeof(uint32_t) * this->m_textSize); this->m_textInfo = textInfo; - void* fontMem = SMemAlloc(sizeof(CSimpleFontedFrameFont), __FILE__, __LINE__, 0); - CSimpleFontedFrameFont* font = new (fontMem) CSimpleFontedFrameFont(this); + auto fontMem = SMemAlloc(sizeof(CSimpleFontedFrameFont), __FILE__, __LINE__, 0x0); + auto font = new (fontMem) CSimpleFontedFrameFont(this); this->m_font = font; this->m_font->m_attributes.SetJustifyH(0x1); // TODO - // void* stringMem = CDataAllocator::GetData(CSimpleFontString::s_allocator, 0, __FILE__, __LINE__); - void* stringMem = SMemAlloc(sizeof(CSimpleFontString), __FILE__, __LINE__, 0); - CSimpleFontString* string = new (stringMem) CSimpleFontString(this, DRAWLAYER_ARTWORK, 1); + // auto stringMem = CDataAllocator::GetData(CSimpleFontString::s_allocator, 0, __FILE__, __LINE__); + auto stringMem = SMemAlloc(sizeof(CSimpleFontString), __FILE__, __LINE__, 0x0); + auto string = new (stringMem) CSimpleFontString(this, DRAWLAYER_ARTWORK, 1); this->m_string = string; this->m_string->SetFontObject(this->m_font); @@ -113,9 +113,9 @@ CSimpleEditBox::CSimpleEditBox(CSimpleFrame* parent) : CSimpleFrame(parent) { for (int32_t i = 0; i < 3; i++) { // TODO - // void* highlightMem = CDataAllocator::GetData(CSimpleTexture::s_allocator, 0, __FILE__, __LINE__); - void* highlightMem = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0); - CSimpleTexture* highlight = new (highlightMem) CSimpleTexture(this, DRAWLAYER_ARTWORK, 0); + // auto highlightMem = CDataAllocator::GetData(CSimpleTexture::s_allocator, 0, __FILE__, __LINE__); + auto highlightMem = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto highlight = new (highlightMem) CSimpleTexture(this, DRAWLAYER_ARTWORK, 0); this->m_highlight[i] = highlight; } @@ -126,9 +126,9 @@ CSimpleEditBox::CSimpleEditBox(CSimpleFrame* parent) : CSimpleFrame(parent) { } // TODO - // void* cursorMem = CDataAllocator::GetData(CSimpleTexture::s_allocator, 0, __FILE__, __LINE__); - void* cursorMem = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0); - CSimpleTexture* cursor = new (cursorMem) CSimpleTexture(this, DRAWLAYER_ARTWORK_OVERLAY, 1); + // auto cursorMem = CDataAllocator::GetData(CSimpleTexture::s_allocator, 0, __FILE__, __LINE__); + auto cursorMem = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto cursor = new (cursorMem) CSimpleTexture(this, DRAWLAYER_ARTWORK_OVERLAY, 1); cursor->Hide(); this->m_cursor = cursor; diff --git a/src/ui/CSimpleFont.cpp b/src/ui/CSimpleFont.cpp index 80db984..2f614b2 100644 --- a/src/ui/CSimpleFont.cpp +++ b/src/ui/CSimpleFont.cpp @@ -15,13 +15,8 @@ int32_t CSimpleFont::s_metatable; int32_t CSimpleFont::s_objectType; SIMPLEFONT::SIMPLEFONT() : TSHashObject() { - void* m = SMemAlloc(sizeof(CSimpleFont), __FILE__, __LINE__, 0); - - if (m) { - this->font = new (m) CSimpleFont(); - } else { - this->font = nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleFont), __FILE__, __LINE__, 0x0); + this->font = new (m) CSimpleFont(); } void CSimpleFont::CreateScriptMetaTable() { diff --git a/src/ui/CSimpleFrame.cpp b/src/ui/CSimpleFrame.cpp index 97a3f03..31d2372 100644 --- a/src/ui/CSimpleFrame.cpp +++ b/src/ui/CSimpleFrame.cpp @@ -702,7 +702,7 @@ void CSimpleFrame::LoadXML_Attributes(XMLNode* node, CStatus* status) { } void CSimpleFrame::LoadXML_Backdrop(XMLNode* node, CStatus* status) { - void* m = SMemAlloc(sizeof(CBackdropGenerator), __FILE__, __LINE__, 0x0); + auto m = SMemAlloc(sizeof(CBackdropGenerator), __FILE__, __LINE__, 0x0); auto backdrop = new (m) CBackdropGenerator(); backdrop->LoadXML(node, status); diff --git a/src/ui/CSimpleHTML.cpp b/src/ui/CSimpleHTML.cpp index f12eb7b..a679ea9 100644 --- a/src/ui/CSimpleHTML.cpp +++ b/src/ui/CSimpleHTML.cpp @@ -49,9 +49,9 @@ CSimpleHTML::CSimpleHTML(CSimpleFrame* parent) : CSimpleHyperlinkedFrame(parent) } void CSimpleHTML::AddText(const char* text, HTML_TEXT_TYPE type, uint32_t justify) { - // TODO void* stringMem = CDataAllocator::GetData(CSimpleFontString::s_allocator, 0x0, __FILE__, __LINE__); - void* stringMem = SMemAlloc(sizeof(CSimpleFontString), __FILE__, __LINE__, 0x0); - CSimpleFontString* string = new (stringMem) CSimpleFontString(this, DRAWLAYER_ARTWORK, 1); + // TODO auto stringMem = CDataAllocator::GetData(CSimpleFontString::s_allocator, 0x0, __FILE__, __LINE__); + auto stringMem = SMemAlloc(sizeof(CSimpleFontString), __FILE__, __LINE__, 0x0); + auto string = new (stringMem) CSimpleFontString(this, DRAWLAYER_ARTWORK, 1); if (this->m_layoutAnchor) { string->SetPoint( diff --git a/src/ui/CSimpleModelFFX.cpp b/src/ui/CSimpleModelFFX.cpp index a8140fa..95b3f62 100644 --- a/src/ui/CSimpleModelFFX.cpp +++ b/src/ui/CSimpleModelFFX.cpp @@ -8,15 +8,9 @@ int32_t CSimpleModelFFX::s_metatable; CSimpleFrame* CSimpleModelFFX::Create(CSimpleFrame* parent) { // TODO - // void* m = CDataAllocator::GetData(CSimpleModelFFX::s_simpleModelFFXHeap, 0, __FILE__, __LINE__); - - void* m = SMemAlloc(sizeof(CSimpleModelFFX), __FILE__, __LINE__, 0); - - if (m) { - return new (m) CSimpleModelFFX(parent); - } else { - return nullptr; - } + // auto m = CDataAllocator::GetData(CSimpleModelFFX::s_simpleModelFFXHeap, 0, __FILE__, __LINE__); + auto m = SMemAlloc(sizeof(CSimpleModelFFX), __FILE__, __LINE__, 0x0); + return new (m) CSimpleModelFFX(parent); } void CSimpleModelFFX::Render(void* arg) { diff --git a/src/ui/CSimpleTop.cpp b/src/ui/CSimpleTop.cpp index 2fdfc52..25fe4df 100644 --- a/src/ui/CSimpleTop.cpp +++ b/src/ui/CSimpleTop.cpp @@ -371,8 +371,8 @@ CSimpleTop::CSimpleTop() : CLayoutFrame() { // TODO for (int32_t s = 0; s < NUM_FRAME_STRATA; s++) { - void* m = SMemAlloc(sizeof(CFrameStrata), __FILE__, __LINE__, 0); - this->m_strata[s] = m ? new (m) CFrameStrata() : nullptr; + auto m = SMemAlloc(sizeof(CFrameStrata), __FILE__, __LINE__, 0x0); + this->m_strata[s] = new (m) CFrameStrata(); } // TODO diff --git a/src/ui/FrameXML.cpp b/src/ui/FrameXML.cpp index af8c445..8b920ef 100644 --- a/src/ui/FrameXML.cpp +++ b/src/ui/FrameXML.cpp @@ -21,55 +21,35 @@ TSHashTable FrameXML::s_factoryHash; TSHashTable FrameXML::s_nodeHash; CSimpleFrame* Create_SimpleButton(CSimpleFrame* parent) { - void* m = SMemAlloc(sizeof(CSimpleButton), __FILE__, __LINE__, 0); - // TODO - // void* m = CDataAllocator::GetData(CSimpleFrame::s_simpleButtonHeap, 0, __FILE__, __LINE__); + // auto m = CDataAllocator::GetData(CSimpleFrame::s_simpleButtonHeap, 0, __FILE__, __LINE__); - if (m) { - return new (m) CSimpleButton(parent); - } else { - return nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleButton), __FILE__, __LINE__, 0x0); + return new (m) CSimpleButton(parent); } CSimpleFrame* Create_SimpleCheckButton(CSimpleFrame* parent) { - void* m = SMemAlloc(sizeof(CSimpleCheckbox), __FILE__, __LINE__, 0); - // TODO - // void* m = CDataAllocator::GetData(CSimpleCheckbox::s_simpleCheckboxHeap, 0, __FILE__, __LINE__); + // auto m = CDataAllocator::GetData(CSimpleCheckbox::s_simpleCheckboxHeap, 0, __FILE__, __LINE__); - if (m) { - return new (m) CSimpleCheckbox(parent); - } else { - return nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleCheckbox), __FILE__, __LINE__, 0x0); + return new (m) CSimpleCheckbox(parent); } CSimpleFrame* Create_SimpleEditBox(CSimpleFrame* parent) { - void* m = SMemAlloc(sizeof(CSimpleEditBox), __FILE__, __LINE__, 0); - // TODO - // void* m = CDataAllocator::GetData(CSimpleEditBox::s_simpleEditBoxHeap, 0, __FILE__, __LINE__); + // auto m = CDataAllocator::GetData(CSimpleEditBox::s_simpleEditBoxHeap, 0, __FILE__, __LINE__); - if (m) { - return new (m) CSimpleEditBox(parent); - } else { - return nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleEditBox), __FILE__, __LINE__, 0x0); + return new (m) CSimpleEditBox(parent); } CSimpleFrame* Create_SimpleFrame(CSimpleFrame* parent) { - void* m = SMemAlloc(sizeof(CSimpleFrame), __FILE__, __LINE__, 0); - // TODO - // void* m = CDataAllocator::GetData(CSimpleFrame::s_simpleFrameHeap, 0, __FILE__, __LINE__); + // auto m = CDataAllocator::GetData(CSimpleFrame::s_simpleFrameHeap, 0, __FILE__, __LINE__); - if (m) { - return new (m) CSimpleFrame(parent); - } else { - return nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleFrame), __FILE__, __LINE__, 0x0); + return new (m) CSimpleFrame(parent); } CSimpleFrame* Create_SimpleMessageFrame(CSimpleFrame* parent) { @@ -79,29 +59,19 @@ CSimpleFrame* Create_SimpleMessageFrame(CSimpleFrame* parent) { } CSimpleFrame* Create_SimpleModel(CSimpleFrame* parent) { - void* m = SMemAlloc(sizeof(CSimpleModel), __FILE__, __LINE__, 0); - // TODO - // void* m = CDataAllocator::GetData(CSimpleFrame::s_simpleModelHeap, 0, __FILE__, __LINE__); + // auto m = CDataAllocator::GetData(CSimpleFrame::s_simpleModelHeap, 0, __FILE__, __LINE__); - if (m) { - return new (m) CSimpleModel(parent); - } else { - return nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleModel), __FILE__, __LINE__, 0x0); + return new (m) CSimpleModel(parent); } CSimpleFrame* Create_SimpleScrollFrame(CSimpleFrame* parent) { - void* m = SMemAlloc(sizeof(CSimpleScrollFrame), __FILE__, __LINE__, 0); - // TODO - // void* m = CDataAllocator::GetData(CSimpleScrollFrame::s_simpleScrollHeap, 0, __FILE__, __LINE__); + // auto m = CDataAllocator::GetData(CSimpleScrollFrame::s_simpleScrollHeap, 0, __FILE__, __LINE__); - if (m) { - return new (m) CSimpleScrollFrame(parent); - } else { - return nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleScrollFrame), __FILE__, __LINE__, 0x0); + return new (m) CSimpleScrollFrame(parent); } CSimpleFrame* Create_SimpleScrollingMessageFrame(CSimpleFrame* parent) { @@ -111,29 +81,19 @@ CSimpleFrame* Create_SimpleScrollingMessageFrame(CSimpleFrame* parent) { } CSimpleFrame* Create_SimpleSlider(CSimpleFrame* parent) { - void* m = SMemAlloc(sizeof(CSimpleSlider), __FILE__, __LINE__, 0); - // TODO - // void* m = CDataAllocator::GetData(CSimpleSlider::s_simpleSliderHeap, 0, __FILE__, __LINE__); + // auto m = CDataAllocator::GetData(CSimpleSlider::s_simpleSliderHeap, 0, __FILE__, __LINE__); - if (m) { - return new (m) CSimpleSlider(parent); - } else { - return nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleSlider), __FILE__, __LINE__, 0x0); + return new (m) CSimpleSlider(parent); } CSimpleFrame* Create_SimpleHTML(CSimpleFrame* parent) { - void* m = SMemAlloc(sizeof(CSimpleHTML), __FILE__, __LINE__, 0); - // TODO - // void* m = CDataAllocator::GetData(CSimpleHTML::s_simpleHTMLHeap, 0, __FILE__, __LINE__); + // auto m = CDataAllocator::GetData(CSimpleHTML::s_simpleHTMLHeap, 0, __FILE__, __LINE__); - if (m) { - return new (m) CSimpleHTML(parent); - } else { - return nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleHTML), __FILE__, __LINE__, 0x0); + return new (m) CSimpleHTML(parent); } CSimpleFrame* Create_SimpleStatusBar(CSimpleFrame* parent) { diff --git a/src/ui/LoadXML.cpp b/src/ui/LoadXML.cpp index 34d0cd4..b9d7c70 100644 --- a/src/ui/LoadXML.cpp +++ b/src/ui/LoadXML.cpp @@ -245,17 +245,10 @@ int32_t LoadXML_Insets(XMLNode* node, float& left, float& right, float& top, flo CSimpleFontString* LoadXML_String(XMLNode* node, CSimpleFrame* frame, CStatus* status) { // TODO - // v3 = CDataAllocator::GetData(CSimpleFontString::s_allocator, 0, a__avcsimplefon, -2); + // auto m = CDataAllocator::GetData(CSimpleFontString::s_allocator, 0, a__avcsimplefon, -2); - void* m = SMemAlloc(sizeof(CSimpleFontString), __FILE__, __LINE__, 0); - - CSimpleFontString* fontString; - - if (m) { - fontString = new (m) CSimpleFontString(frame, 2, 1); - } else { - fontString = nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleFontString), __FILE__, __LINE__, 0x0); + auto fontString = new (m) CSimpleFontString(frame, 2, 1); fontString->PreLoadXML(node, status); fontString->LoadXML(node, status); @@ -266,17 +259,10 @@ CSimpleFontString* LoadXML_String(XMLNode* node, CSimpleFrame* frame, CStatus* s CSimpleTexture* LoadXML_Texture(XMLNode* node, CSimpleFrame* frame, CStatus* status) { // TODO - // v3 = (CSimpleTexture *)CDataAllocator::GetData((int)CSimpleTexture::s_allocator, 0, a__avcsimpletex, -2); + // auto m = (CSimpleTexture *)CDataAllocator::GetData((int)CSimpleTexture::s_allocator, 0, a__avcsimpletex, -2); - void* m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0); - - CSimpleTexture* texture; - - if (m) { - texture = new (m) CSimpleTexture(frame, 2, 1); - } else { - texture = nullptr; - } + auto m = SMemAlloc(sizeof(CSimpleTexture), __FILE__, __LINE__, 0x0); + auto texture = new (m) CSimpleTexture(frame, 2, 1); texture->PreLoadXML(node, status); texture->LoadXML(node, status); diff --git a/src/ui/LuaMemory.cpp b/src/ui/LuaMemory.cpp index 8644a9c..d9c6c69 100644 --- a/src/ui/LuaMemory.cpp +++ b/src/ui/LuaMemory.cpp @@ -6,24 +6,17 @@ #include void* luaM_initPool() { - void* v0 = SMemAlloc(sizeof(MemPool*) * 9, ".\\src\\lmemPool.cpp", 243, 0); - MemPool** pools = (MemPool**)v0; + void* m = SMemAlloc(sizeof(MemPool*) * 9, __FILE__, __LINE__, 0x0); + MemPool** pools = (MemPool**)m; uint32_t v2 = 0; - void* v3; - MemPool* v4; size_t v5; size_t v6; do { - v3 = SMemAlloc(sizeof(MemPool), ".\\src\\lmemPool.cpp", 245, 0); - - if (v3) { - v4 = new (v3) MemPool(); - } else { - v4 = 0; - } + auto poolMem = SMemAlloc(sizeof(MemPool), __FILE__, __LINE__, 0x0); + auto v4 = new (poolMem) MemPool(); pools[v2] = v4; diff --git a/src/util/BlizzardCore.cpp b/src/util/BlizzardCore.cpp index 88c93f9..a8bec56 100644 --- a/src/util/BlizzardCore.cpp +++ b/src/util/BlizzardCore.cpp @@ -209,8 +209,8 @@ void Blizzard::System_Thread::AddToRegistry(Thread::ThreadRecord* thread) { Blizzard::Lock::MutexEnter(System_Thread::s_registryMutex); if (!System_Thread::s_threadRegistry) { - void* v2 = Blizzard::Memory::Allocate(sizeof(std::map), 0, __FILE__, __LINE__, nullptr); - System_Thread::s_threadRegistry = new (v2) std::map(); + auto m = Blizzard::Memory::Allocate(sizeof(std::map), 0, __FILE__, __LINE__, nullptr); + System_Thread::s_threadRegistry = new (m) std::map(); } System_Thread::s_threadRegistry->insert(std::pair(thread, thread));