changeset 697:2dfb67633b01

GUIButton Release Allocator BigMemory fix?
author zipi
date Sun, 17 Mar 2013 14:25:00 +0000
parents 4e1b2a24a6e3
children 0c6510a626e2
files Allocator.cpp GUIButton.cpp GUIButton.h mm7_1.cpp mm7_4.cpp mm7_5.cpp
diffstat 6 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/Allocator.cpp	Sun Mar 17 13:57:46 2013 +0000
+++ b/Allocator.cpp	Sun Mar 17 14:25:00 2013 +0000
@@ -75,7 +75,7 @@
 			  AbortWithError();
 		  }
 
-	  pMemoryBuffers[uNumBuffersUsed] = (char *)(pBigBufferAligned) + uNextFreeOffsetInBigBuffer;
+	  pMemoryBuffers[uNumBuffersUsed] = (char *)pBigMemoryBuffer + uNextFreeOffsetInBigBuffer;//(char *)(pBigBufferAligned) + uNextFreeOffsetInBigBuffer;
 	  uMemoryBuffersSizes[uNumBuffersUsed] =aligned_size;
 
 	  if (pName)
@@ -201,8 +201,8 @@
 	  for (indx = 0; indx <=uNumBuffersUsed; ++indx)
 		  if (pMemoryBuffers[indx] == ptr)	
 			  break;
-	//  if ((indx>uNumBuffersUsed)&& !aborting_app )
-//		  AbortWithError(); to detect memory problems - uncomment
+	  if ((indx>uNumBuffersUsed)&& !aborting_app )
+		  AbortWithError(); //to detect memory problems - uncomment
 	  if (!bUseBigBuffer)
 		  free(pMemoryBuffers[indx]);
 	  pMemoryBuffers[indx] = NULL;
--- a/GUIButton.cpp	Sun Mar 17 13:57:46 2013 +0000
+++ b/GUIButton.cpp	Sun Mar 17 14:25:00 2013 +0000
@@ -113,12 +113,14 @@
 
 
 //----- (0041D0D8) --------------------------------------------------------
-void GUIButton::_41D0D8(GUIButton *ptr)
+void GUIButton::Release()
 {
   GUIWindow *v1; // eax@2
   GUIButton *v2; // edx@2
   GUIButton *v3; // eax@6
+  GUIButton *ptr;
 
+  ptr=this;
   if ( ptr )
   {
     v1 = ptr->pParent;
--- a/GUIButton.h	Sun Mar 17 13:57:46 2013 +0000
+++ b/GUIButton.h	Sun Mar 17 14:25:00 2013 +0000
@@ -7,7 +7,7 @@
 {
   char DrawLabel(const char *edx0, struct GUIFont *pFont, int a5, int *a9);
 
-  static void _41D0D8(GUIButton *ptr);
+  void Release();
 
 
   unsigned int uX;
--- a/mm7_1.cpp	Sun Mar 17 13:57:46 2013 +0000
+++ b/mm7_1.cpp	Sun Mar 17 14:25:00 2013 +0000
@@ -87,7 +87,7 @@
     for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )
     {
       if ( BYTE1(i->field_1C) & 0x80 )
-        GUIButton::_41D0D8(i);
+        i->Release();
     }
     for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext )
     {
--- a/mm7_4.cpp	Sun Mar 17 13:57:46 2013 +0000
+++ b/mm7_4.cpp	Sun Mar 17 14:25:00 2013 +0000
@@ -10703,7 +10703,7 @@
     else
     {
       for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
-        GUIButton::_41D0D8((GUIButton *)HouseNPCData[i + 7]);
+        ((GUIButton *)HouseNPCData[i + 7])->Release();
     }
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
     pBtn_ExitCancel = pDialogueWindow->CreateButton(  471u,  445u,  169u, 35u,  1,   0, 0x71u,  0,  0,
--- a/mm7_5.cpp	Sun Mar 17 13:57:46 2013 +0000
+++ b/mm7_5.cpp	Sun Mar 17 14:25:00 2013 +0000
@@ -3049,8 +3049,8 @@
           continue;
         case UIMSG_55:
           bRingsShownInCharScreen ^= v0;
-          GUIButton::_41D0D8(pCharacterScreen_DetalizBtn);
-          GUIButton::_41D0D8(pCharacterScreen_DollBtn);
+		  pCharacterScreen_DetalizBtn->Release();
+          pCharacterScreen_DollBtn->Release();
           if ( bRingsShownInCharScreen )
           {
             v128 = (uTextureID_5118C8 != -1 ? pIcons_LOD->pTextures[uTextureID_5118C8].uTextureHeight : 26);
@@ -17447,9 +17447,9 @@
   if ( dword_507CBC )
   {
     dword_507CBC = 0;
-    GUIButton::_41D0D8(ptr_507BA4);
-    GUIButton::_41D0D8(pBtn_Up);
-    GUIButton::_41D0D8(pBtn_Down);
+	ptr_507BA4->Release();
+    pBtn_Up->Release();
+    pBtn_Down->Release();
     pBtn_Down = 0;
     pBtn_Up = 0;
     for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )