Thread: RE: [GD-Windows] How to determine total physical memory available ?
Brought to you by:
vexxed72
From: Yannick L. <yle...@ub...> - 2004-01-26 20:21:34
|
Actually it would be a little more complicated since memory can be a = sum of different power of 2 (for example if you have one memory chip of 128 MB = and another of 64 MB totaling 192MB which is not power of 2). I'd rather not make this kind of assumption myself and let the system = give me the exact numbers ;-) -----Original Message----- From: Timur Davidenko [mailto:ti...@cr...] Sent: Monday, January 26, 2004 3:16 PM To: gam...@li... Subject: RE: [GD-Windows] How to determine total physical memory available ? I guess System Information tool just rounds this number to the next "reasonable" number. It knows that memory chips don't come in 1022Mb setups.. So it`s quite easy to round number you get to closest power of 2.. _____________________ Timur Davidenko. Crytek (http://www.crytek.com) -----Original Message----- From: Yannick Letourneau [mailto:yle...@ub...]=20 Sent: Monday, January 26, 2004 8:47 PM To: gam...@li... Subject: [GD-Windows] How to determine total physical memory available = ? I need to determine how much memory is installed on the user's system somehow. I used GlobalMemoryStatus but the values returned in the member = dwTotalPhys is always underestimating a bit. For example on my dev machine it = returns 1022 MB although I have 1024 MB installed. Same thing happens on all systems I've tested. Same thing is reported in dxdiag.exe so they seem to use that function = as well. However, when I use the System Information tool in the system tools of Windows, it correctly reports 1024 MB. So anyone knows how I can get the exact information ? Yannick L=E9tourneau UBISOFT ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 |
From: Yannick L. <yle...@ub...> - 2004-01-26 20:32:35
|
I tried your suggestion (both GlobalMemoryStatusEx and = GlobalMemoryStatus) and unfortunately this doesn't give the right result on my system = either. Instead of 1022 MB it will report 1023 MB... Yannick -----Original Message----- From: Carsten Orthbandt [mailto:car...@se...] Sent: Monday, January 26, 2004 3:08 PM To: gam...@li... Subject: RE: [GD-Windows] How to determine total physical memory available ? IIRC, GlobalMemoryStatus returns the actual amount of RAM minus the DOS-inherited 640 kB base memory. After actually checking that: Yep, add 640 kB (=3D655360 byte) to the value in xMS.dwTotalPhys and you got the real value. When doing anything of this kind, please consider using = GlobalMemoryStatusEx on Win2k/XP systems. We're not that far from systems having the full = 4GB space equipped. Carsten Orthbandt Founder + Development Director SEK SpieleEntwicklungsKombinat GmbH http://www.sek-ost.de Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt =20 > -----Original Message----- > From: gam...@li...=20 > [mailto:gam...@li...] On=20 > Behalf Of Yannick Letourneau > Sent: Monday, January 26, 2004 8:47 PM > To: gam...@li... > Subject: [GD-Windows] How to determine total physical memory=20 > available ? >=20 >=20 > I need to determine how much memory is installed on the user's system > somehow. >=20 > I used GlobalMemoryStatus but the values returned in the=20 > member dwTotalPhys > is always underestimating a bit. For example on my dev=20 > machine it returns > 1022 MB although I have 1024 MB installed. Same thing happens on all > systems I've tested. >=20 > Same thing is reported in dxdiag.exe so they seem to use that=20 > function as > well. >=20 > However, when I use the System Information tool in the system tools = of > Windows, it correctly reports 1024 MB. >=20 > So anyone knows how I can get the exact information ? >=20 > Yannick L=E9tourneau > UBISOFT >=20 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 |
From: Yannick L. <yle...@ub...> - 2004-01-26 21:15:01
|
Both ;-) Yeah, right now I'm doing as you're suggesting but I still would like = to display the right value to the user. I guess I'll have to live with it unless I find a better way. Yannick -----Original Message----- From: Simon O'Connor [mailto:si...@sc...] Sent: Monday, January 26, 2004 4:07 PM To: gam...@li... Subject: RE: [GD-Windows] How to determine total physical memory available ? BTW: Do you actually need the value for presentation to the user? Or is this to determine whether the user has enough physical memory to = run your game or use advanced memory hungry features? If it's the latter, then you should only really use the value as a = rough guide (much the same as with total video memory), e.g.: if (memorysize < 500000000) { alert( "sorry this game requires a minimum of 512MB" ); return; } m_enableMemoryHoggingFeature =3D false; if (memorysize >=3D 1000000000) { m_enableMemoryHoggingFeature =3D true; } Of course, you can never assume all of that physical memory is yours to = play with anyway (kernel allocations, AGP reservation etc). Simon O'Connor Programmer @ Acclaim & Microsoft DirectX MVP=20 > -----Original Message----- > From: gam...@li...=20 > [mailto:gam...@li...] On=20 > Behalf Of Yannick Letourneau > Sent: 26 January 2004 20:21 > To: gam...@li... > Subject: RE: [GD-Windows] How to determine total physical=20 > memory available ? >=20 > Actually it would be a little more complicated since memory=20 > can be a sum of different power of 2 (for example if you have=20 > one memory chip of 128 MB and another of 64 MB totaling 192MB=20 > which is not power of 2). >=20 > I'd rather not make this kind of assumption myself and let=20 > the system give me the exact numbers ;-) >=20 > -----Original Message----- > From: Timur Davidenko [mailto:ti...@cr...] > Sent: Monday, January 26, 2004 3:16 PM > To: gam...@li... > Subject: RE: [GD-Windows] How to determine total physical=20 > memory available ? >=20 >=20 > I guess System Information tool just rounds this number to=20 > the next "reasonable" number. > It knows that memory chips don't come in 1022Mb setups.. > So it`s quite easy to round number you get to closest power of 2.. >=20 > _____________________ > Timur Davidenko. > Crytek (http://www.crytek.com) >=20 > -----Original Message----- > From: Yannick Letourneau [mailto:yle...@ub...] > Sent: Monday, January 26, 2004 8:47 PM > To: gam...@li... > Subject: [GD-Windows] How to determine total physical memory=20 > available ? >=20 > I need to determine how much memory is installed on the=20 > user's system somehow. >=20 > I used GlobalMemoryStatus but the values returned in the=20 > member dwTotalPhys is always underestimating a bit. For=20 > example on my dev machine it returns > 1022 MB although I have 1024 MB installed. Same thing=20 > happens on all systems I've tested. >=20 > Same thing is reported in dxdiag.exe so they seem to use that=20 > function as well. >=20 > However, when I use the System Information tool in the system=20 > tools of Windows, it correctly reports 1024 MB. >=20 > So anyone knows how I can get the exact information ? >=20 > Yannick L=E9tourneau > UBISOFT >=20 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference on Open Tools Development and Integration See the=20 > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference on Open Tools Development and Integration See the=20 > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference on Open Tools Development and Integration See the=20 > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > =20 >=20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 =20 ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 |
From: Simon O'C. <si...@sc...> - 2004-01-27 00:37:39
|
Although I've not tried it myself, WMI (assuming 2K/XP) seems to have a = few things for getting lots of information about the hardware - not sure how much of that info is available on all systems though - I'll give it a = try when I get a free moment - there's a lot of very intriguing stuff you = can query in there such as: "Win32_PhysicalMemoryArray" "Win32_PhysicalMemoryLocation" "Win32_PhysicalMemory" Which seem to have stuff as hardcore as the chip package type, speed in = ns, chip manufacturer, bank layout. Simon O'Connor Programmer @ Acclaim & Microsoft DirectX MVP =20 > -----Original Message----- > From: gam...@li...=20 > [mailto:gam...@li...] On=20 > Behalf Of Yannick Letourneau > Sent: 26 January 2004 21:15 > To: gam...@li... > Subject: RE: [GD-Windows] How to determine total physical=20 > memory available ? >=20 > Both ;-) >=20 > Yeah, right now I'm doing as you're suggesting but I still=20 > would like to display the right value to the user. I guess=20 > I'll have to live with it unless I find a better way. >=20 > Yannick >=20 > -----Original Message----- > From: Simon O'Connor [mailto:si...@sc...] > Sent: Monday, January 26, 2004 4:07 PM > To: gam...@li... > Subject: RE: [GD-Windows] How to determine total physical=20 > memory available ? >=20 >=20 >=20 > BTW: >=20 > Do you actually need the value for presentation to the user? >=20 > Or is this to determine whether the user has enough physical=20 > memory to run your game or use advanced memory hungry features? >=20 >=20 > If it's the latter, then you should only really use the value=20 > as a rough guide (much the same as with total video memory), e.g.: >=20 > if (memorysize < 500000000) > { > alert( "sorry this game requires a minimum of 512MB" ); > return; > } >=20 > m_enableMemoryHoggingFeature =3D false; >=20 > if (memorysize >=3D 1000000000) > { > m_enableMemoryHoggingFeature =3D true; > } >=20 >=20 > Of course, you can never assume all of that physical memory=20 > is yours to play with anyway (kernel allocations, AGP=20 > reservation etc). >=20 >=20 > Simon O'Connor > Programmer @ Acclaim > & Microsoft DirectX MVP=20 >=20 > > -----Original Message----- > > From: gam...@li... > > [mailto:gam...@li...]=20 > On Behalf Of=20 > > Yannick Letourneau > > Sent: 26 January 2004 20:21 > > To: gam...@li... > > Subject: RE: [GD-Windows] How to determine total physical memory=20 > > available ? > >=20 > > Actually it would be a little more complicated since memory=20 > can be a=20 > > sum of different power of 2 (for example if you have one=20 > memory chip=20 > > of 128 MB and another of 64 MB totaling 192MB which is not power of=20 > > 2). > >=20 > > I'd rather not make this kind of assumption myself and let=20 > the system=20 > > give me the exact numbers ;-) > >=20 > > -----Original Message----- > > From: Timur Davidenko [mailto:ti...@cr...] > > Sent: Monday, January 26, 2004 3:16 PM > > To: gam...@li... > > Subject: RE: [GD-Windows] How to determine total physical memory=20 > > available ? > >=20 > >=20 > > I guess System Information tool just rounds this number to the next=20 > > "reasonable" number. > > It knows that memory chips don't come in 1022Mb setups.. > > So it`s quite easy to round number you get to closest power of 2.. > >=20 > > _____________________ > > Timur Davidenko. > > Crytek (http://www.crytek.com) > >=20 > > -----Original Message----- > > From: Yannick Letourneau [mailto:yle...@ub...] > > Sent: Monday, January 26, 2004 8:47 PM > > To: gam...@li... > > Subject: [GD-Windows] How to determine total physical=20 > memory available=20 > > ? > >=20 > > I need to determine how much memory is installed on the=20 > user's system=20 > > somehow. > >=20 > > I used GlobalMemoryStatus but the values returned in the member=20 > > dwTotalPhys is always underestimating a bit. For example on my dev=20 > > machine it returns > > 1022 MB although I have 1024 MB installed. Same thing=20 > happens on all=20 > > systems I've tested. > >=20 > > Same thing is reported in dxdiag.exe so they seem to use=20 > that function=20 > > as well. > >=20 > > However, when I use the System Information tool in the=20 > system tools of=20 > > Windows, it correctly reports 1024 MB. > >=20 > > So anyone knows how I can get the exact information ? > >=20 > > Yannick L=E9tourneau > > UBISOFT > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference=20 > > on Open Tools Development and Integration See the breadth=20 > of Eclipse=20 > > activity. February 3-5 in Anaheim, CA. > > http://www.eclipsecon.org/osdn > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference=20 > > on Open Tools Development and Integration See the breadth=20 > of Eclipse=20 > > activity. February 3-5 in Anaheim, CA. > > http://www.eclipsecon.org/osdn > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > >=20 > >=20 > > ------------------------------------------------------- > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference=20 > > on Open Tools Development and Integration See the breadth=20 > of Eclipse=20 > > activity. February 3-5 in Anaheim, CA. > > http://www.eclipsecon.org/osdn > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > >=20 > > --- > > Incoming mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > > =20 > >=20 >=20 > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > =20 >=20 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference on Open Tools Development and Integration See the=20 > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference on Open Tools Development and Integration See the=20 > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > =20 >=20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 =20 |
From: Pierre T. <pie...@no...> - 2004-01-27 16:09:13
|
Hi, Is there a standard place where third party libraries can store their DLLs ? We want to release a SDK whose DLLs should be accessible by both the demos (exes in their own \demos directory) and the programmers compiling the examples or doing their own. The obvious solution is to copy our DLLs in the System or System32 directory at installation time, but it doesn't sound very nice to pollute that place with extra DLLs (it's messy enough...) Is it better to store the DLLs in some private directory (say Program Files\MyProduct\MyDlls), and add that directory to the path env variable ? If yes, is there a recommended way to do that ? Else, is there an "official" way to do that ? Pierre |
From: Jon W. <hp...@mi...> - 2004-01-27 17:32:53
|
These days, Microsoft recommends that each application install the DLLs with the EXE. The reason for this is that DLL versioning problems have bit too many programs too many times. For an ActiveX control or .NET Assembly module, that's not doable, of course, although the .NET hierarchy seems to have space for third party code, and ActiveX controls can go in Program Files/YourNameHere and use RegSvr32 to tell the system where to find it. Cheers, / h+ -----Original Message----- From: gam...@li... [mailto:gam...@li...]On Behalf Of Pierre Terdiman Sent: Tuesday, January 27, 2004 8:16 AM To: gam...@li... Subject: [GD-Windows] DLL location Hi, Is there a standard place where third party libraries can store their DLLs ? We want to release a SDK whose DLLs should be accessible by both the demos (exes in their own \demos directory) and the programmers compiling the examples or doing their own. The obvious solution is to copy our DLLs in the System or System32 directory at installation time, but it doesn't sound very nice to pollute that place with extra DLLs (it's messy enough...) Is it better to store the DLLs in some private directory (say Program Files\MyProduct\MyDlls), and add that directory to the path env variable ? If yes, is there a recommended way to do that ? Else, is there an "official" way to do that ? Pierre ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555 |
From: Jon W. <hp...@mi...> - 2004-01-31 01:28:51
|
Does anyone know a reference for standard vertex lighting in DirectX 8 level vertex shader code? It seems like it should be available on MSDN, or perhaps on one of many good reference sites out there, but I can't find any! The closest I have come is the ARB_vertex_program OpenGL specification, which contains code for many pieces of the standard OpenGL lighting equation. (Yes, I can translate, and also write my own, but I'd like a reference) Cheers, / h+ |
From: Simon O'C. <si...@sc...> - 2004-01-31 04:24:11
|
There are a few on the nVidia site that may be of interest: http://developer.nvidia.com/object/cg_fixed_function.html http://developer.nvidia.com/object/fixed_function_pipeline.html I'm sure (ISTR) there are are more direct pages too... Simon O'Connor Programmer @ Acclaim & Microsoft DirectX MVP > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On > Behalf Of Jon Watte > Sent: 31 January 2004 01:26 > To: gam...@li... > Subject: [GD-Windows] DLL location > > > Does anyone know a reference for standard vertex lighting in > DirectX 8 level vertex shader code? It seems like it should > be available on MSDN, or perhaps on one of many good > reference sites out there, but I can't find any! The closest > I have come is the ARB_vertex_program OpenGL specification, > which contains code for many pieces of the standard OpenGL > lighting equation. > (Yes, I can translate, and also write my own, but I'd like a > reference) > > Cheers, > > / h+ > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 Premiere > Conference on Open Tools Development and Integration See the > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.572 / Virus Database: 362 - Release Date: 27/01/2004 > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.572 / Virus Database: 362 - Release Date: 27/01/2004 |
From: Jon W. <hp...@mi...> - 2004-01-31 18:33:40
|
First, sorry to use the wrong title initially, and thanks for the answer! The second link (PDF) seems to be NV_vertex_program and claims it's a work in progress, and looking at the code, I agree :-) Although the PDF declares that a final version is forthcoming, I couldn't find it, so I suppose that project was dropped. I can translate, but I already have my own shaders -- the gist of my request is to get "another implementation" to look at for comparision. I'll run the first link through CG and see what comes out; that might be more like what I'm looking for. Cheers, / h+ -----Original Message----- From: gam...@li... [mailto:gam...@li...]On Behalf Of Simon O'Connor Sent: Friday, January 30, 2004 8:24 PM To: gam...@li... Subject: RE: [GD-Windows] DLL location There are a few on the nVidia site that may be of interest: http://developer.nvidia.com/object/cg_fixed_function.html http://developer.nvidia.com/object/fixed_function_pipeline.html I'm sure (ISTR) there are are more direct pages too... Simon O'Connor Programmer @ Acclaim & Microsoft DirectX MVP |
From: Simon O'C. <si...@sc...> - 2004-02-09 00:18:27
|
A follow up in case anyone still needs to do this: I've had a play around with WMI this weekend and it is indeed the way to = go for getting this kind of thing on 2K/XP machines. Win32_PhysicalMemory = gets its info from the system BIOS. For simplicity I've been using VB/VBScript, but the C++ method is the = same, albeit with a lot of extra COM handling.=20 Here's a simple VBS example of returning true physical memory info (to = run it, copy what's below into a text file and give the file a .VBS = extension): For Each Mem in = GetObject("winmgmts:").InstancesOf("Win32_PhysicalMemory") WScript.Echo("Bank=3D" & Mem.BankLabel & " Size=3D" & Mem.Capacity / (1024*1024) & "MB") Next Cheers, Simon O'Connor Programmer @ Acclaim & Microsoft DirectX MVP=20 > -----Original Message----- > From: gam...@li...=20 > [mailto:gam...@li...] On=20 > Behalf Of Simon O'Connor > Sent: 27 January 2004 00:38 > To: gam...@li... > Subject: RE: [GD-Windows] How to determine total physical=20 > memory available ? >=20 >=20 > Although I've not tried it myself, WMI (assuming 2K/XP) seems=20 > to have a few things for getting lots of information about=20 > the hardware - not sure how much of that info is available on=20 > all systems though - I'll give it a try when I get a free=20 > moment - there's a lot of very intriguing stuff you can query=20 > in there such as: >=20 > "Win32_PhysicalMemoryArray" > "Win32_PhysicalMemoryLocation" > "Win32_PhysicalMemory" >=20 > Which seem to have stuff as hardcore as the chip package=20 > type, speed in ns, chip manufacturer, bank layout. >=20 > Simon O'Connor > Programmer @ Acclaim > & Microsoft DirectX MVP =20 >=20 > > -----Original Message----- > > From: gam...@li... > > [mailto:gam...@li...]=20 > On Behalf Of=20 > > Yannick Letourneau > > Sent: 26 January 2004 21:15 > > To: gam...@li... > > Subject: RE: [GD-Windows] How to determine total physical memory=20 > > available ? > >=20 > > Both ;-) > >=20 > > Yeah, right now I'm doing as you're suggesting but I still=20 > would like=20 > > to display the right value to the user. I guess I'll have to live=20 > > with it unless I find a better way. > >=20 > > Yannick > >=20 > > -----Original Message----- > > From: Simon O'Connor [mailto:si...@sc...] > > Sent: Monday, January 26, 2004 4:07 PM > > To: gam...@li... > > Subject: RE: [GD-Windows] How to determine total physical memory=20 > > available ? > >=20 > >=20 > >=20 > > BTW: > >=20 > > Do you actually need the value for presentation to the user? > >=20 > > Or is this to determine whether the user has enough=20 > physical memory to=20 > > run your game or use advanced memory hungry features? > >=20 > >=20 > > If it's the latter, then you should only really use the value as a=20 > > rough guide (much the same as with total video memory), e.g.: > >=20 > > if (memorysize < 500000000) > > { > > alert( "sorry this game requires a minimum of 512MB" ); > > return; > > } > >=20 > > m_enableMemoryHoggingFeature =3D false; > >=20 > > if (memorysize >=3D 1000000000) > > { > > m_enableMemoryHoggingFeature =3D true; } > >=20 > >=20 > > Of course, you can never assume all of that physical memory=20 > is yours=20 > > to play with anyway (kernel allocations, AGP reservation etc). > >=20 > >=20 > > Simon O'Connor > > Programmer @ Acclaim > > & Microsoft DirectX MVP=20 > >=20 > > > -----Original Message----- > > > From: gam...@li... > > > [mailto:gam...@li...]=20 > > On Behalf Of=20 > > > Yannick Letourneau > > > Sent: 26 January 2004 20:21 > > > To: gam...@li... > > > Subject: RE: [GD-Windows] How to determine total physical memory=20 > > > available ? > > >=20 > > > Actually it would be a little more complicated since memory=20 > > can be a=20 > > > sum of different power of 2 (for example if you have one=20 > > memory chip=20 > > > of 128 MB and another of 64 MB totaling 192MB which is=20 > not power of=20 > > > 2). > > >=20 > > > I'd rather not make this kind of assumption myself and let=20 > > the system=20 > > > give me the exact numbers ;-) > > >=20 > > > -----Original Message----- > > > From: Timur Davidenko [mailto:ti...@cr...] > > > Sent: Monday, January 26, 2004 3:16 PM > > > To: gam...@li... > > > Subject: RE: [GD-Windows] How to determine total physical memory=20 > > > available ? > > >=20 > > >=20 > > > I guess System Information tool just rounds this number=20 > to the next=20 > > > "reasonable" number. > > > It knows that memory chips don't come in 1022Mb setups.. > > > So it`s quite easy to round number you get to closest power of 2.. > > >=20 > > > _____________________ > > > Timur Davidenko. > > > Crytek (http://www.crytek.com) > > >=20 > > > -----Original Message----- > > > From: Yannick Letourneau [mailto:yle...@ub...] > > > Sent: Monday, January 26, 2004 8:47 PM > > > To: gam...@li... > > > Subject: [GD-Windows] How to determine total physical=20 > > memory available=20 > > > ? > > >=20 > > > I need to determine how much memory is installed on the=20 > > user's system=20 > > > somehow. > > >=20 > > > I used GlobalMemoryStatus but the values returned in the member=20 > > > dwTotalPhys is always underestimating a bit. For example=20 > on my dev=20 > > > machine it returns > > > 1022 MB although I have 1024 MB installed. Same thing=20 > > happens on all=20 > > > systems I've tested. > > >=20 > > > Same thing is reported in dxdiag.exe so they seem to use=20 > > that function=20 > > > as well. > > >=20 > > > However, when I use the System Information tool in the=20 > > system tools of=20 > > > Windows, it correctly reports 1024 MB. > > >=20 > > > So anyone knows how I can get the exact information ? > > >=20 > > > Yannick L=E9tourneau > > > UBISOFT > > >=20 > > >=20 > > >=20 > > > ------------------------------------------------------- > > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > > Conference=20 > > > on Open Tools Development and Integration See the breadth=20 > > of Eclipse=20 > > > activity. February 3-5 in Anaheim, CA. > > > http://www.eclipsecon.org/osdn > > > _______________________________________________ > > > Gamedevlists-windows mailing list > > > Gam...@li... > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > Archives: > > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > > >=20 > > >=20 > > >=20 > > > ------------------------------------------------------- > > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > > Conference=20 > > > on Open Tools Development and Integration See the breadth=20 > > of Eclipse=20 > > > activity. February 3-5 in Anaheim, CA. > > > http://www.eclipsecon.org/osdn > > > _______________________________________________ > > > Gamedevlists-windows mailing list > > > Gam...@li... > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > Archives: > > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > > >=20 > > >=20 > > > ------------------------------------------------------- > > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > > Conference=20 > > > on Open Tools Development and Integration See the breadth=20 > > of Eclipse=20 > > > activity. February 3-5 in Anaheim, CA. > > > http://www.eclipsecon.org/osdn > > > _______________________________________________ > > > Gamedevlists-windows mailing list > > > Gam...@li... > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > Archives: > > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > > >=20 > > > --- > > > Incoming mail is certified Virus Free. > > > Checked by AVG anti-virus system (http://www.grisoft.com). > > > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > > > =20 > > >=20 > >=20 > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > > =20 > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > > Conference on Open Tools Development and Integration See the=20 > > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > > http://www.eclipsecon.org/osdn > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > >=20 > >=20 > > ------------------------------------------------------- > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > > Conference on Open Tools Development and Integration See the=20 > > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > > http://www.eclipsecon.org/osdn > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > >=20 > > --- > > Incoming mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > > =20 > >=20 >=20 > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > =20 >=20 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > =20 >=20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.572 / Virus Database: 362 - Release Date: 27/01/2004 =20 |
From: Simon O'C. <si...@sc...> - 2004-01-26 21:07:21
|
BTW: Do you actually need the value for presentation to the user? Or is this to determine whether the user has enough physical memory to = run your game or use advanced memory hungry features? If it's the latter, then you should only really use the value as a rough guide (much the same as with total video memory), e.g.: if (memorysize < 500000000) { alert( "sorry this game requires a minimum of 512MB" ); return; } m_enableMemoryHoggingFeature =3D false; if (memorysize >=3D 1000000000) { m_enableMemoryHoggingFeature =3D true; } Of course, you can never assume all of that physical memory is yours to = play with anyway (kernel allocations, AGP reservation etc). Simon O'Connor Programmer @ Acclaim & Microsoft DirectX MVP=20 > -----Original Message----- > From: gam...@li...=20 > [mailto:gam...@li...] On=20 > Behalf Of Yannick Letourneau > Sent: 26 January 2004 20:21 > To: gam...@li... > Subject: RE: [GD-Windows] How to determine total physical=20 > memory available ? >=20 > Actually it would be a little more complicated since memory=20 > can be a sum of different power of 2 (for example if you have=20 > one memory chip of 128 MB and another of 64 MB totaling 192MB=20 > which is not power of 2). >=20 > I'd rather not make this kind of assumption myself and let=20 > the system give me the exact numbers ;-) >=20 > -----Original Message----- > From: Timur Davidenko [mailto:ti...@cr...] > Sent: Monday, January 26, 2004 3:16 PM > To: gam...@li... > Subject: RE: [GD-Windows] How to determine total physical=20 > memory available ? >=20 >=20 > I guess System Information tool just rounds this number to=20 > the next "reasonable" number. > It knows that memory chips don't come in 1022Mb setups.. > So it`s quite easy to round number you get to closest power of 2.. >=20 > _____________________ > Timur Davidenko. > Crytek (http://www.crytek.com) >=20 > -----Original Message----- > From: Yannick Letourneau [mailto:yle...@ub...] > Sent: Monday, January 26, 2004 8:47 PM > To: gam...@li... > Subject: [GD-Windows] How to determine total physical memory=20 > available ? >=20 > I need to determine how much memory is installed on the=20 > user's system somehow. >=20 > I used GlobalMemoryStatus but the values returned in the=20 > member dwTotalPhys is always underestimating a bit. For=20 > example on my dev machine it returns > 1022 MB although I have 1024 MB installed. Same thing=20 > happens on all systems I've tested. >=20 > Same thing is reported in dxdiag.exe so they seem to use that=20 > function as well. >=20 > However, when I use the System Information tool in the system=20 > tools of Windows, it correctly reports 1024 MB. >=20 > So anyone knows how I can get the exact information ? >=20 > Yannick L=E9tourneau > UBISOFT >=20 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference on Open Tools Development and Integration See the=20 > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference on Open Tools Development and Integration See the=20 > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > Conference on Open Tools Development and Integration See the=20 > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > =20 >=20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 =20 |