It is currently Thu May 23, 2013 6:23 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: UDRes Userlibrary (Userdefined Resources use and compile)
PostPosted: Sat Jul 08, 2006 7:49 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
This library create compiled userdefined resources without another
resource-compiler, without resource-script or temporary files.
The resourcetyp is "PBDATA". Only ID-numbers, no name for the resources.

The resources can automatically packed and unpacked with brieflz. (included
in this library)

This is a good alternate to IncludeBinary. Resources a not loaded
automatically in RAM with exe or dll, other then IncludeBinary.

Only Import the created *.res and use the resource with the functions from
this lib.

English-Help and Examples included.

Download

//edit
New downloadlink

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Last edited by ts-soft on Sat May 10, 2008 5:19 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 11:18 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
Thank you ts-soft, this is very interesting. :)

I don't know a great deal about resource files. However, I'm working on a large project in which I've created quite a large resource script containing a whole bunch of icons which I then load with LoadIcon_() and display with DrawIconEx_(). Can I still do this with UDRES? My fear is that if I use CatchImage(), this then regards the icon as a bitmap and I lose the ability to display the icon with a transparent background!

I guess I'm asking if there's a way of combining UDRES with my own resource scripts also?

Impressive work nevertheless.

Thanks again.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 2:35 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
@srod
Sorry, in the moment only userdefined resources. The only possible
ResourceType is "PBDATA" (same as RC_DATA, but another name)

I have no information to load it other than as this:

Code:
ResName.s = "#" + Str(ResNumber)

hFind = FindResource_(hModule, ResName.s, @"PBDATA")
If hFind
  hLoad = LoadResource_(hModule, hFind)
  hSize = SizeofResource_(hModule, hFind)
  hLock = LockResource_(hLoad)

  Mem = AllocateMemory(hSize)

  If Mem
    CopyMemory(hLock, Mem, hSize)
    FreeResource_(hLock)
    ProcedureReturn Mem
  EndIf
EndIf

The Resource Header is a dynamic Structure, it's not so easy and the
documentation isn't good, but i will enhance it in the future :wink:
So in the moment only Catch from Mem or Save to disk, but all binarys are
no problem (Catch RTF oder LoadLibraryM and so on)

I hope there comes more features in the next releases

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 2:55 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
I understand.

Thanks.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 3:44 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
I will add extra function for icons (only numbered) and stringtable. Would this
be sufficient?

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 4:09 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
That would be brilliant and cover about all of my needs as far as resources go.

This is going to be one handy little library. :D

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 6:59 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
Big problem with icon and so on.
The first off header a long is the datasize, but this is different :cry:

Quote:
DataSize The size of the data that follows the header. This value does not include any file padding bytes added after the actual data.
The format of the data is different for any of the possible resource types. Data size is expressed in BYTEs (8 bit unsigned integer).

The real DataSize doesn't work, i have no information to change this value
Compiled with Porc, this value isn't the FileSize, so i don't know, what is the
DataSize for icons :?:

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 09, 2006 1:17 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
Sorry I can't help at the mo, it's beyond my experience.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 07, 2006 12:43 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
Update

New functions:
Quote:
UDRes_GetFunction
UDRes_GetPackFunction


The same Functions as GetFunction in PB, but directly for a DLL in Resource
Is DLL not loaded, so loadet automatic in memory and unload at programend.
Example:
Code:
#PB_DLL = 1

Import "PureBasic.res" : EndImport

CallFunctionFast(UDRes_GetPackFunction(#PB_DLL, "EasyRequester"), "Test")


Also added a threadsafe version as subsystem

Download in first post

regards
Thomas

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 10, 2006 4:28 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
Update

New Functions:
Quote:
UDRes_CatchImage
UDRes_CatchPackImage
UDRes_CatchSound
UDRes_CatchPackSound
UDRes_CatchSprite
UDRes_CatchPackSprite

Nearly the same as the catchfunctions in PB, but for UserDefinded Resources
All Catched Sounds, Sprites or Images a only ones in Memory, other than
IncludeBinary!

Download in first post

regards
Thomas

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject: SO how do i move from this DLL call to a res file
PostPosted: Tue Oct 31, 2006 3:51 am 
Offline
User
User

Joined: Wed Jun 28, 2006 6:02 am
Posts: 43
How do I use UDRes to get rid of this:

Code:
OpenLibrary(0,"mt19937ar.dll"); opens random generator library
CallFunction(0, "init_genrand", timeGetTime_()); seed the PRNG
*genrand31 = GetFunction(0, "genrand_int31"); get pointer to function in the dll


then later in the code I do:

Code:
myrandom=mindemand+Int(CallFunctionFast(*genrand31)/#MAXLONG *(maxdemand-mindemand))


so I what changes to both codes and what do I do with UDREs to achieve it?

Thanks

Dan Raymond

[/code]
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 31, 2006 8:31 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
use this for example:
Code:
init_genrand = UDRes_GetFunction(1, "init_genrand")
CallFunctionFast(init_genrand, timeGetTime_())
*genrand31 = UDRes_GetFunction(1, "genrand_int31")

(DLL has Resourcenumber 1 in the example)

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 02, 2006 2:01 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
Excellent work ts-soft.

Thanks.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 02, 2006 2:05 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
srod wrote:
Excellent work ts-soft.

Thanks.
thanks :D

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 09, 2007 7:39 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
Update:
Added 2 Functions
Code:
UDRes_GetModuleHandle(ResNumber.l [, hModule.l])
UDRes_GetPackModuleHandle(ResNumber.l [, hModule.l])

The result is the ModuleHandle. With this, you can load all resources from included DLL

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye