aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorChris Apers2005-11-05 10:34:47 +0000
committerChris Apers2005-11-05 10:34:47 +0000
commitc6bacf3b38dd34b4a9bdb0fadb1fc88638584ec9 (patch)
tree1345d736ab0e8637b7c8fe715596e1276df51415 /backends
parent5dd6c51c77d2714b224cf85dfd83be1640cb3136 (diff)
downloadscummvm-rg350-c6bacf3b38dd34b4a9bdb0fadb1fc88638584ec9.tar.gz
scummvm-rg350-c6bacf3b38dd34b4a9bdb0fadb1fc88638584ec9.tar.bz2
scummvm-rg350-c6bacf3b38dd34b4a9bdb0fadb1fc88638584ec9.zip
- Fiwed small memory leak on form close
- Moved GetMemory to init_palmos.cpp svn-id: r19440
Diffstat (limited to 'backends')
-rw-r--r--backends/PalmOS/Src/forms/forminfo.cpp67
1 files changed, 13 insertions, 54 deletions
diff --git a/backends/PalmOS/Src/forms/forminfo.cpp b/backends/PalmOS/Src/forms/forminfo.cpp
index 01f086ecbc..74622d8f14 100644
--- a/backends/PalmOS/Src/forms/forminfo.cpp
+++ b/backends/PalmOS/Src/forms/forminfo.cpp
@@ -4,7 +4,9 @@
#include "formTabs.h"
#include "forms.h"
-#include "version.h"
+#include "base/version.h"
+#include "globals.h"
+#include "init_palmos.h"
/***********************************************************************
*
@@ -28,55 +30,6 @@ static UInt32 GetStackSize() {
return ((Char *)endPP - (Char *)startPP) / 1024L;
}
-void GetMemory(UInt32* storageMemoryP, UInt32* dynamicMemoryP, UInt32 *storageFreeP, UInt32 *dynamicFreeP) {
- UInt32 free, max;
-
- Int16 i;
- Int16 nCards;
- UInt16 cardNo;
- UInt16 heapID;
-
- UInt32 storageMemory = 0;
- UInt32 dynamicMemory = 0;
- UInt32 storageFree = 0;
- UInt32 dynamicFree = 0;
-
- // Iterate through each card to support devices with multiple cards.
- nCards = MemNumCards();
-
- for (cardNo = 0; cardNo < nCards; cardNo++) {
- // Iterate through the RAM heaps on a card (excludes ROM).
- for (i=0; i< MemNumRAMHeaps(cardNo); i++) {
- // Obtain the ID of the heap.
- heapID = MemHeapID(cardNo, i);
- // Calculate the total memory and free memory of the heap.
- MemHeapFreeBytes(heapID, &free, &max);
-
- // If the heap is dynamic, increment the dynamic memory total.
- if (MemHeapDynamic(heapID)) {
- dynamicMemory += MemHeapSize(heapID);
- dynamicFree += free;
-
- // The heap is nondynamic (storage ?).
- } else {
- storageMemory += MemHeapSize(heapID);
- storageFree += free;
- }
- }
- }
- // Reduce the stats to KB. Round the results.
- dynamicMemory = dynamicMemory / 1024L;
- storageMemory = storageMemory / 1024L;
-
- dynamicFree = dynamicFree / 1024L;
- storageFree = storageFree / 1024L;
-
- if (dynamicMemoryP) *dynamicMemoryP = dynamicMemory;
- if (storageMemoryP) *storageMemoryP = storageMemory;
- if (dynamicFreeP) *dynamicFreeP = dynamicFree;
- if (storageFreeP) *storageFreeP = storageFree;
-}
-
static void VersionTabDraw() {
WinDrawChars(gScummVMVersion, StrLen(gScummVMVersion), 47, 12 + 30);
WinDrawChars(gScummVMBuildDate, StrLen(gScummVMBuildDate), 47, 24 + 30);
@@ -87,12 +40,13 @@ static void SystemTabDraw() {
UInt32 dm, sm, df, sf, stack;
Char num[10];
- GetMemory(&sm, &dm, &sf, &df);
+ PalmGetMemory(&sm, &dm, &sf, 0);
stack = GetStackSize();
-
+ df = gVars->startupMemory;
+
WinSetTextColor(UIColorGetTableEntryIndex(UIObjectForeground));
FntSetFont(stdFont);
-
+
StrIToA(num, dm);
x = 147 - FntCharsWidth(num, StrLen(num)) + 5;
WinDrawChars(num, StrLen(num), x, 12 + 30);
@@ -161,6 +115,11 @@ Boolean InfoFormHandleEvent(EventPtr eventP) {
InfoFormInit();
handled = true;
break;
+
+ case frmCloseEvent:
+ InfoFormSave();
+ handled = true;
+ break;
case ctlSelectEvent:
switch (eventP->data.ctlSelect.controlID)
@@ -182,6 +141,6 @@ Boolean InfoFormHandleEvent(EventPtr eventP) {
default:
break;
}
-
+
return handled;
}