Raised This Month: $ Target: $400
 0% 

HunkMaster - HLDS memory filter


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-01-2013 , 11:44   Re: HunkMaster - HLDS memory filter
Reply With Quote #21

That hard, don't know, but it's what I was thinking, because most likely more reliable.
If you look at IDA, you can get where it's called (one or several times) :

COM_LoadFile
SZ_Alloc
Host_Init
Mod_LoadTextures
Mod_LoadEntities
Mod_LoadSubmodels
Mod_LoadTexinfo
Mod_LoadFaces
Mod_LoadNodes
Mod_LoadLeafs
Mod_LoadClipnodes
Mod_LoadPlanes
Mod_LoadBrushModel
Mod_LoadAliasGroup
Mod_LoadAliasSkinGroup
Mod_LoadAliasModel
Mod_LoadSpriteFrame
Mod_LoadSpriteModel
Mod_LoadLighting
Mod_LoadVisibility
Mod_LoadVertexes
Mod_LoadEdges
Mod_MakeHull0
Mod_LoadMarksurfaces
Mod_LoadSurfedges
Mod_LoadAliasFrame
Mod_LoadAliasSkin
Mod_LoadSpriteGroup
SV_SpawnServer
SV_SetMaxclients
R_InitTextures

Though, if we could know easily figuring out what the server really needs would save time.
__________________
Arkshine is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 01-01-2013 , 12:37   Re: HunkMaster - HLDS memory filter
Reply With Quote #22

What about changing the way engine handles the alloc?

For example:

Quote:
Hook this, change "option" and then call original
char *COM_LoadFile(char *filename, int option, int *something)

Where

option = 1 => Hunk_AllocName
option = 2 => Hunk_TempAlloc // This one seems to be useful for not needed resources
option = 3 => Cache_Alloc
option = 4 => Hunk_TempAlloc (if loadsize is not enough)
option = 5 => Mem_Malloc
other => Sys_Error
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Backup
Senior Member
Join Date: Jul 2010
Location: Česká Republika
Old 01-01-2013 , 14:14   Re: HunkMaster - HLDS memory filter
Reply With Quote #23

joropito:
It would be nice to have variable hunk size, but:
> there are many calls directly to alloc functions, so you'd have to hook them all
> in that case it can be no longer a metamod plugin, because you have to hook memory initialization function which is called before metamod is loaded. A launcher would be a solution.
__________________
Sorry for my english.
Backup is offline
Old 01-01-2013, 15:16
_GamerX
This message has been deleted by Arkshine. Reason: English only please.
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 01-01-2013 , 17:22   Re: HunkMaster - HLDS memory filter
Reply With Quote #24

Quote:
Originally Posted by Backup View Post
joropito:
It would be nice to have variable hunk size, but:
> there are many calls directly to alloc functions, so you'd have to hook them all
> in that case it can be no longer a metamod plugin, because you have to hook memory initialization function which is called before metamod is loaded. A launcher would be a solution.

I see your point.

About variable hunk size.
I see some behaviour when Hunk_AllocName is called. Some sprites has the same size each with other and some not.
Also the biggest sizes belongs to map, baselines and edicts (both can't be touched). There's something with a NULL name..

My questions:

1- What is that NULL section?

2- If something inside a map should be not loaded, isn't better to hook Mod_Load* to avoid that? (maybe I misunderstand the way you do the thing)

3- What are those sprites after the map? Can't be blocked to load? (I've tried to allocate them using Hunk_TempAlloc with luck)

Here's what de_chateau loads (summarized sizes for each Hunk_AllocName call and total accumulated size)
Spoiler
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Backup
Senior Member
Join Date: Jul 2010
Location: Česká Republika
Old 01-01-2013 , 18:32   Re: HunkMaster - HLDS memory filter
Reply With Quote #25

Quote:
Originally Posted by joropito View Post
1- What is that NULL section?
Do you mean "unknown"?
Quote:
Originally Posted by joropito View Post
2- If something inside a map should be not loaded, isn't better to hook Mod_Load* to avoid that? (maybe I misunderstand the way you do the thing)
Yes, that would be much more elegant way to do it. But also harder, it would be a pain in the ass to hook all these functions. In my dirtier approach i have everything in one place so I can easily decide what to keep and what to drop. But you're right, it's wrong to alloc stuff and write data into it just for freeing it afterwards.
Quote:
Originally Posted by joropito View Post
3- What are those sprites after the map? Can't be blocked to load?
These are allocated by precache_model function. And these precaches are called from mp.dll from function W_Precache. Avoiding call of that function causes precache errors (message in meaning "stuff can be loaded only in precache, not now").
__________________
Sorry for my english.
Backup is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 01-01-2013 , 19:31   Re: HunkMaster - HLDS memory filter
Reply With Quote #26

Quote:
Originally Posted by Backup View Post
Neeeeeeeeeel.-:
dust is small, try inferno, chateau, torn...
You were right

Spoiler


Edit: Joropito, are you going to make it for linux?
__________________

Last edited by Neeeeeeeeeel.-; 01-03-2013 at 11:35.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Firewall_
Senior Member
Join Date: Aug 2012
Old 01-03-2013 , 12:00   Re: HunkMaster - HLDS memory filter
Reply With Quote #27

we wait linux version =)
Firewall_ is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 01-08-2013 , 23:46   Re: HunkMaster - HLDS memory filter
Reply With Quote #28

I love it good work!
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 01-09-2013 , 01:31   Re: HunkMaster - HLDS memory filter
Reply With Quote #29

Quote:
Originally Posted by rak View Post
I love it good work!
We know Mr. ram-saver.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 01-09-2013 , 23:58   Re: HunkMaster - HLDS memory filter
Reply With Quote #30

Quote:
Originally Posted by Backup View Post
joropito:
It would be nice to have variable hunk size, but:
> there are many calls directly to alloc functions, so you'd have to hook them all
> in that case it can be no longer a metamod plugin, because you have to hook memory initialization function which is called before metamod is loaded. A launcher would be a solution.
Do you think if I can change how the thing works and just allocate the size requested (not restricted with chunk sizes) and deallocate the unneeded segments will be better?

I know how to do that.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode