Jump to content
SSForum.net is back!

Drake7707

⛊ Project Moderator
  • Posts

    1309
  • Joined

  • Last visited

Everything posted by Drake7707

  1. it snowed for a weekend here, buttttttttttt not for the following weeks now
  2. That doesn't make much of a difference, the problem is the 'textures' for lvz or the temporary bitmaps for selection, regions etc that's causing the memory of the video card to overflow. The preview where you actually draw on doesn't take much memory at all. Reloading lvz's takes quite a lot of time, especially when there are a lot of them, because it has to reload everything from disk. And discarding unnecessary temporary bitmaps not needed at the time is already happening. One thing that can be done is like this (wonder why i think of it only now ): instead of caching it on the disk you could cache it in general memory by using GetDIBits to retrieve all the pixels from the hdc into an array (much like clsPic does). I think i'll write a resource manager for that ^^ brb Option Explicit Private Type resource id As Long path As String cached As Boolean pixelarr() As Byte hdc As Long End Type Dim resources() As resource Dim resourceCount As Integer 'current id count to make a unique id Dim curIdCount As Long 'video memory used for resources Dim memUsed As Long Const MAX_MEMORY = 134217728 '128mb Sub load(imgPath As String) If resourceCount >= UBound(resources) Then ReDim Preserve resources(resourceCount + 100) End If Dim r As resource r.id = makeUniqueID r.path = imgPath '// TODO ' calculate memory for resource Dim memForResource As Long If memUsed + memForResource > MAX_MEMORY Then 'loading this resource will cause the memory to overflow 'swap out a resource that's not used to standard memory freeMemory (memForResource) End If memUsed = memUsed + memForResource End Sub Private Function makeUniqueID() As Long 'make a unique id for each resource makeUniqueID = curIdCount curIdCount = curIdCount + 1 End Function Sub save(id As Integer, path As String) Dim hdc As Long hdc = getResource(id) '//TODO 'save resource to path End Sub Sub discard(id As Integer) Dim idx As Integer idx = getResourceById(id) If idx <> -1 Then 'discard resource '// TODO 'calculate memory for resource Dim memForResource As Long '// TODO 'destroy its hdc memUsed = memUsed - memForResource Dim i As Integer For i = idx + 1 To resourceCount - 1 resources(i - 1) = resources(i) Next resourceCount = resourceCount - 1 End If End Sub Function getResource(id As Integer) As Long 'returns the hdc where the image is ready Dim idx As Integer idx = getResourceById(id) If idx <> -1 Then If resources(idx).cached Then '// TODO 'we need to restore the array back to a hdc, but we need to make 'sure that we still have enough memory Else getResource = resources(idx).hdc End If End If End Function Private Sub freeMemory(mem As Long) 'ensure that we have enough memory to load mem into the video ram 'move resources from their hdc's to arrays here Do While memUsed + mem > MAX_MEMORY '// TODO 'Clear out resources here 'select resources by a certain criteria (oldest, least used ?) and cache them Dim resID As Integer cache (resID) Loop End Sub Sub cache(id As Integer) Dim idx As Integer idx = getResourceById(id) If idx <> -1 Then 'force cache of the resource 'dump them to an array If resources(idx).cached Then 'it's already cached Else '//TODO 'move the hdc to an array '// TODO ' calculate memory for resource Dim memForResource As Long memUsed = memUsed - memForResource End If End If End Sub 'returns index of resource by id Private Function getResourceById(id As Integer) As Integer Dim i As Integer For i = 0 To resourceCount - 1 If resources(i).id = id Then getResourceById = i Exit Function End If Next getResourceById = -1 End Function Private Sub Class_Initialize() ReDim resources(100) resourceCount = 0 memUsed = 0 End Sub Private Sub Class_Terminate() 'delete all remaining resources Dim i As Integer For i = 0 To resourceCount - 1 Call discard(resources(i).id) Next End Sub I know, still a lot of todo's: - hdc -> array dump - array -> hdc - memory calculation of a resource - selection process of which resource to cache when there's not enough memory anymore (least used could be done with a timestamp for each resource, oldest could be done with a stack that pushes all the resources in it and the oldest is element 0)
  3. lol, going to a lan would be the equavalent of wearing my shirt I got from sun (at devoxx '08) with 'Source Wars' on the back in star wars font and 'May the Source be with you' on the front in a public place.
  4. yet another moron sigh. They should ban guns like they did here, unless you have a license for a gun you aren't permitted to have one
  5. I'm using opera at the moment, it responds a lot faster than firefox or ie does. But it has some annoyances such as sites that aren't supported, mouse gestures that sometimes annoy me, some crashes (rarely but annoying).
  6. ahh fuzzy logic, how i hate no boolean values ^^ Nice project ^^, reminds me of the 1 day project we had to do in lego to remove cans from a certain area within a circle (big black circle so the light sensor would pick that up )
  7. 1 day strike last october, 20% more traffic and quite a lot more traffic jam :/
  8. i will be learning each day because i have 10 exams waiting for me mid january. Also i nevered travelled before (never ever) so i doubt i'll go anywhere at all
  9. eh i just block it with my hands or arm :/, i don't really have to sneeze all that much anyway ^^
  10. holding it in is bad, you're essentially blocking air that wants to get out at over 120km/h (holding it in increases pressure everywhere causing you get headache, pain in the throat etc). I can trigger my sneezing if i stick my pen in my nose xD (gently tickling nose hairs = insta sneeze)
  11. Thanks
  12. Yes you did http://www.ssforum.net/index.php?showtopic=21929 ^^
  13. he should have been the one that died :/
  14. perhaps a slideshow of screenshots might be more clear (and smaller in size) ?
  15. ah, so that was what i saw moving in the shadow of DCME
  16. a few others i player are jazz jackrabbit, lots of pinballs (my dad was a bit addicted to them ), duke 1 and 2
  17. well gee, easy to say bad things about others stuff now is it j/k , it is crappy after all
  18. oh right commander keen time to visit http://freeoldies.com/index.php again, dosbox up and running
  19. ehm Lotus III Turbo challenge, Simpsons game in dos and many other dos games, can't really remember
  20. It seems that there is an issue with the bgPen tool. It doesn't leak in vb itself, but win xp has some serious issues with drawing windows after a while. I copied the code to use in my AI algorithm for gui drawing and i keep getting windows blacked out after a lot of drawing, even when the objects are deleted afterwards. Either the bgpen implementation isn't used correctly, or there is a bug in the API. Perhaps switching to an alternative could fix some drawing issues
  21. yeah, we kinda need to update the tips section with the new stuff
  22. this is a video ram issue, the latest version caches much more images in ram than older versions. That error occurs when there isn't enough video memory anymore. Sama is looking into it
  23. Oh wait, move it back I thought he was talking about uploading pictures on the board that screw with the preview colors, my bad
  24. actually, i have the same thing (i just tried the clean build on a school computer). I made a new map -> saved the map -> closed DCME -> reopened DCME -> opened map i saved --> Error And daaaaaaaaaaaaaamn it is fast ^^
×
×
  • Create New...