@Fred, Please publish some PB structures...

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
IceSoft
Addict
Addict
Posts: 1683
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

@Fred, Please publish some PB structures...

Post by IceSoft »

... it will help to write additional features (which are currently missed) for PB.
And I belive it will help also to make PureBasic as the first choice of a basic language once more.

Like this one: Thanks S.M. for that.
S.M. wrote:This code should return the current DC:

Code: Select all

Procedure DrawingDC() 
!extrn _PB_2DDrawing_GlobalStructure 
!MOV EAX,[_PB_2DDrawing_GlobalStructure] 
ProcedureReturn 
Endprocedure
A few other variables:

Code: Select all

 ----------------------------------------------------------------------- 
  2DDrawing
  --------- 

  _PB_2DDrawing_GlobalStructure 
  _PB_2DDrawing_Globals 

  ; internal functions 
  _PB_2DDrawing_SwitchToDC@0 
  _PB_2DDrawing_SwitchToDC_THREAD@0 

  Structure DrawingInfoStruct 
    Type.l    ; Type of the DC 
    Window.l  ; Window associated to the DC (if any) 
    DC.l      ; DC (Display Device Context) 
    ReleaseProcedure.l ; Address to a procedure to release the DC when StopDrawing() is called 
    PixelBuffer.l      ; Address of the memory pixel buffer (DirectX) 
    Pitch.l            ; Bytes per line (DirectX) 
    Width.l 
    Height.l 
    Depth.l 
  EndStructure 

  ----------------------------------------------------------------------- 
  SimpleList
  ---------- 

  _PB_FreeSimpleLists@0 
  _PB_InitSimpleList@0 
  _PB_SimpleList_Add 
  _PB_SimpleList_AddAfter 
  _PB_SimpleList_Count 
  _PB_SimpleList_Heap 
  _PB_SimpleList_IsID 
  _PB_SimpleList_Remove 

  ----------------------------------------------------------------------- 
  Image
  ----- 
  _PB_Image_Globals 
  _PB_Image_Objects 
    
  Structure PB_Image 
    Bitmap.l     ; OS Bitmap pointer (HBITMAP) 
    Width.w      ; Width in pixel of the image 
    Height.w     ; Height in pixel of the image 
    Depth.w      ; Depth in bpp of the image 
    ColorArray.l ; Memory pointer on a color array for 256 colors pictures 
    unknown.w 
  EndStructure 

  ----------------------------------------------------------------------- 
  Object
  ------ 

  ; functions: 
  _PB_Object_Init@12 
  _PB_Object_FreeID@8 
  _PB_Object_EnumerateStart@4 
  _PB_Object_EnumerateNext@8 
  _PB_Object_IsObject@8 
  _PB_Object_GetObject@8 
  _PB_Object_GetOrAllocateID@8 ; returns a pointer to an entry (the ObjectsArea is extended, if needed) 

  _PB_Object_InitThreadMemory@12 
  _PB_Object_GetThreadMemory@4 

  ; Each object has the following structure: 
  Structure PB_Object 
    Size.l         ; Size of one entry in the ObjectsArea (in Bytes) 
    StepSize.l      ; The number of enties which are allocated at once 
    NumEntries.l   ; Current number of Entires 
    Unknown.l[4] 
    ObjectsArea.l  ; pointer to the first entry 
    Unknown2.l[2] 
  EndStructure 

  ; Example for allocating space for a Image: 
  Procedure IMAGE_GetOrAllocImageSpace(Image) 
    !extrn _PB_Image_Objects 
    !extrn _PB_Object_GetOrAllocateID@8 
    !Push dword[Esp+4] 
    !Push dword[_PB_Image_Objects] 
    !CALL _PB_Object_GetOrAllocateID@8 
    ProcedureReturn 
  EndProcedure 

  ----------------------------------------------------------------------- 
  Sprite
  ------ 
  
  _PB_Screen_Width            ; width of the current buffer selected with UseBuffer() 
  _PB_Screen_Height           ; height of the current buffer selected with UseBuffer() 
  _PB_Screen_Depth            ; depth (in bpp) of the current buffer selected with UseBuffer() 
  
  _PB_Screen_RealWidth        ; width of the back buffer 
  _PB_Screen_RealHeight       ; height of the back buffer 
  _PB_Screen_Window           ; ScreenID() (HWND) 
  _PB_Screen_Windowed 

  _PB_Screen_IsActive 
  _PB_Screen_WindowedYOffset 
  _PB_Screen_WindowedXOffset 
  _PB_Screen_AutoStretch 
  _PB_Screen_WindowedRightBorder 
  _PB_Screen_WindowedBottomBorder 
  _PB_Screen_ModesArray        ; pointer to an array of PB_ScreenMode elements 
  _PB_Screen_FlipBuffers 

  _PB_DirectX_CurrentDC      
  _PB_DirectX_FullScreenWindow  ; ScreenID() when full screen is used (HWND) 
  _PB_DirectX_PixelFormat   ; Pixel format (see DrawingBufferPixelFormat() ) of the current buffer selected with UseBuffer() 

  _PB_DirectX_PrimaryBuffer ; Directdraw visible buffer (IDirectDrawSurface7) 
  _PB_DirectX_BackBuffer    ; Directdraw back buffer (IDirectDrawSurface7) 
  
  _PB_DirectX_FrameRate     ; Frame rate set with SetFrameRate(FrameRate) 
  _PB_DirectX_RefreshRate   ; Refresh rate set with SetRefreshRate(RefreshRate) 

  _PB_DirectX_WindowedFrameRate 
  _PB_DirectX_WindowClipper           ; IDirectDrawClipper for windowed screen 
  _PB_DirectX_ActualRefreshRate 
  _PB_DirectX_PreciseTimerDelta 
  _PB_DirectX_PreciseTimerOldValue 
  _PB_DirectX_SaveAllSpritesSurfaces 

  _PB_Sprite_Objects 
  _PB_Sprite_CheckFXBuffer 
  _PB_Sprite_ColorKey 
  _PB_Sprite_CurrentDC 
  _PB_Sprite_BufferDC 
  _PB_Sprite_SpecialEffectMode 
  _PB_Sprite_AlphaBlueModifier 
  _PB_Sprite_AlphaGreenModifier 
  _PB_Sprite_AlphaRedModifier 
  _PB_Sprite_TranslucentLUT 

  _PB_Sprite_FillDrawingInfo 
  _PB_Sprite_SpriteInfo 
  _PB_Sprite_CurrentBitmapInfo 
  _PB_Sprite_FXBufferInfo      ; the pointer to a DDSURFACEDESC2 structure 
  _PB_Sprite_SpriteFX 
  _PB_Sprite_CurrentBitmap     ; DirectDrawSurface7 pointer of the current buffer (set with UseBuffer()) 
  _PB_Sprite_FXBuffer          ; DirectDrawSurface7 pointer which is used with StartSpecialFX()...StopSpecialFX() 
  _PB_Sprite_LimitFrameRate 
  _PB_Sprite_DEBUG_GetSurfaceData 

  _PB_Screen_V_Quit 
  _PB_Screen_V_FlipWindowedBuffers 
  _PB_Screen_V_FlipBuffers 
  _PB_Screen_V_GetDirectDraw7 
  _PB_Screen_V_GetBackBuffer 
  _PB_Screen_V_OpenScreen3D 

  ; Internal functions 
  _PB_Sprite_GetTrueRGBColor@12 
  _PB_Sprite_InitDirectXScreen@0 
  _PB_Sprite_CreateEmptySprite@20 
  _PB_Sprite_CleanUpAll@0 
  _PB_Sprite_SaveAllSpritesSurfaces@0 
  _PB_Sprite_RestoreAllSpritesSurfaces@0 
  _PB_Sprite_ReleaseScreenOutput@0 
  _PB_Sprite_SetPixelFormat@0 

  Structure PB_Sprite 
    Sprite.IDirectDrawSurface7       ; DirectDrawSurface7 pointer 
    Width.w       ; Current width of the sprite (could change if ClipSprite() is used) 
    Height.w      ; Current height of the sprite (could change if ClipSprite() is used) 
    Depth.w       ; depth of the file. (in bits)  
    Mode.w        ; Sprite mode, as described in LoadSprite() 
    FileName.l    ; Pointer on the filename, if any 
    RealWidth.w   ; Original width of the sprite when it was loaded 
    RealHeight.w  ; Original height of the sprite when it was loaded 
    ClipX.w       ; X offset if ClipSprite() 
    ClipY.w       ; Y offset if ClipSprite() 
  EndStructure 

  Structure PB_ScreenMode 
    ScreenModeWidth.w        ; Width of the Screen (in pixel) 
    ScreenModeHeight.w        ; Height of the Screen (in pixel) 
    ScreenModeDepth.w        ; Depth of the Screen (in bits per pixel) 
    ScreenModeRefreshRate.w  ; Refresh rate of the Screen (in Hz) 
  EndStructure 


  ; DirectDraw7 Structures: 
  Structure DDPIXELFORMAT 
    dwSize.l 
    dwFlags.l 
    dwFourCC.l 
    dwRGBBitCount.l 
    dwRBitMask.l 
    dwGBitMask.l 
    dwBBitMask.l 
    dwRGBAlphaBitMask.l 
  EndStructure 

  Structure DDCOLORKEY 
    dwColorSpaceLowValue.l 
    dwColorSpaceHighValue.l 
  EndStructure 

  Structure DDSCAPS2 
    dwCaps.l 
    dwCaps2.l 
    dwCaps3.l 
    dwCaps4.l 
  EndStructure 

  Structure DDSURFACEDESC2 
    dwSize.l 
    dwFlags.l 
    dwHeight.l 
    dwWidth.l 
    lPitch.l 
    dwBackBufferCount.l 
    dwRefreshRate.l 
    dwAlphaBitDepth.l 
    dwReserved.l 
    lpSurface.l 
    ddckCKDestOverlay.DDCOLORKEY 
    ddckCKDestBlt.DDCOLORKEY 
    ddckCKSrcOverlay.DDCOLORKEY 
    ddckCKSrcBlt.DDCOLORKEY 
    ddpfPixelFormat.DDPIXELFORMAT 
    ddsCaps.DDSCAPS2 
    dwTextureStage.l 
  EndStructure 

  ----------------------------------------------------------------------- 
  Sprite3D
  -------- 
  
  _PB_D3DBase               ; IDirect3D7 
  _PB_Direct3D_Device       ; IDirect3DDevice7 
  _PB_Direct3D_Start3DState ; contains 1 if Start3D() was successfully called (Start3D() creates the D3DDevice7) 
  _PB_3DViewPort       ; points to a D3DVIEWPORT7 structure 
  _PB_Sprite3D_Quality       ; the value set by Sprite3DQuality(Quality) 
  _PB_Sprite3D_Objects 

  Structure PB_Sprite3D 
    Texture.IDirectDrawSurface7 ; DirectDrawSurface7 
    Vertice.D3DTLVERTEX[4]      ; The 4 vertices for the rectangle sprite 
    Width.w         ; width set with ZoomSprite3D() 
    Height.w         ; height set with ZoomSprite3D() 
    unknown.l 
  EndStructure 

  ; Direct3D7 structures: 
  Structure D3DTLVERTEX 
      sx.f            ; X value of the vertex (in pixels) 
      sy.f            ; Y value of the vertex (in pixels) 
      sz.f 
      rhw.f         ; reciprocal of homogeneous w 
      color.l         ; diffuse color 
      specular.l      ; specular color 
      tu.f            ; horizontal texture coordinate of the vertex 
      tv.f            ; vertical texture coordinate of the vertex 
  EndStructure 

  Structure D3DVIEWPORT7 
    dwX.l 
    dwY.l 
    dwWidth.l 
    dwHeight.l 
    dvMinZ.f 
    dvMaxZ.f 
  EndStructure 

  ----------------------------------------------------------------------- 
  Sprite OpenGL Subsystem
  ----------------------- 

  _PB_Sprite_ObjectsNumber   ; number of entries in _PB_Sprite_ObjectsArea 
  _PB_Sprite_ObjectsArea        ; pointer to an array of PB_Sprite elements 

  _PB_Screen_RealWidth        ; width of the back buffer 
  _PB_Screen_RealHeight       ; height of the back buffer 
  _PB_Screen_Window           ; ScreenID() (HWND) 
  _PB_Screen_Windowed 
  _PB_Screen_Target 

  _PB_Screen_IsActive 
  _PB_Screen_WindowedYOffset 
  _PB_Screen_WindowedXOffset 
  _PB_Screen_AutoStretch 
  _PB_Screen_WindowedRightBorder 
  _PB_Screen_WindowedBottomBorder 

  _PB_DirectX_SaveAllSpritesSurfaces ; ? 

  _PB_Sprite_ColorKey 
  _PB_Sprite_SpecialEffectMode 

  ; Internal functions 
  _PB_Sprite_EnumerateAll 
  _PB_Sprite_FreeID 
  _PB_Sprite_GetObject 
  _PB_Sprite_GetOrAllocateID 
  _PB_Sprite_ListFirstElement 

  _PB_Sprite_CreateEmptySprite@20 
  _PB_Sprite_CleanUpAll@0 
  _PB_Sprite_SetPixelFormat@0 


  Structure PB_Sprite 
    Texture.l     ; SpriteID 
    Width.w       ; Current width of the sprite (could change if ClipSprite() is used) 
    Height.w      ; Current height of the sprite (could change if ClipSprite() is used) 
    Depth.w       ; depth of the file. (in bits)  
    Mode.w        ; Sprite mode, as described in LoadSprite() 
    FileName.l    ; Pointer on the filename, if any 
    RealWidth.w   ; Original width of the sprite when it was loaded 
    RealHeight.w  ; Original height of the sprite when it was loaded 
    ClipX.w       ; X offset if ClipSprite() 
    ClipY.w       ; Y offset if ClipSprite() 
  EndStructure 

  ----------------------------------------------------------------------- 
  Sprite3D OpenGL Subsytem
  ------------------------ 

  _PB_Direct3D_Device        ; contains everytime zero 
  _PB_Sprite3D_Quality        ; the value set by Sprite3DQuality(Quality) 
  _PB_Sprite3D_ObjectsNumber ; number of entries in _PB_Sprite3D_ObjectsArea 
  _PB_Sprite3D_ObjectsArea   ; pointer to an array of PB_Sprite3D elements 
  _PB_Sprite3D_CurrentDC 

  ; internal functions: 
  _PB_Sprite3D_FreeID 
  _PB_Sprite3D_GetObject 
  _PB_Sprite3D_GetOrAllocateID 
  _PB_Sprite3D_CurrentObject 
  _PB_Sprite3D_ListFirstElement 

  
  Structure GLVERTEX2D 
    X.f       ; X value of the vertex (in pixels) 
    Y.f         ; Y value of the vertex (in pixels) 
  EndStructure 

  Structure PB_Sprite3D 
    Texture.l              ; SpriteID ( the same as PeekL(IsSprite3D(#Sprite)) ) 
    Vertice.GLVERTEX2D[4]  ; The 4 vertices for the rectangle sprite 
    Width.w                ; width set with ZoomSprite3D() 
    Height.w              ; height set with ZoomSprite3D() 
    Unknown.l 
  EndStructure 
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

That looks like a copy and paste from the Library SDK documentation, although I can never remember what file it's in.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

"Library SDK\PureBasic library descriptor.txt" ;)
User avatar
IceSoft
Addict
Addict
Posts: 1683
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

djes wrote:"Library SDK\PureBasic library descriptor.txt" ;)
No not with PB4.30.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

> And I belive it will help also to make PureBasic as the first choice of a basic language once more.

People say that for every requested feature. This argument is getting old :roll:

We do not publish any internal structures anymore because it limits our ability to further improve PB, as we cannot even change our internal stuff without breaking user code.
quidquid Latine dictum sit altum videtur
User avatar
IceSoft
Addict
Addict
Posts: 1683
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

freak wrote:We do not publish any internal structures anymore because it limits our ability to further improve PB, as we cannot even change our internal stuff without breaking user code.
Come on @freak...this argument is also old...and not true. Have a look on the public command which will be changed with PB4.30. No prob for us.
I belive we have also no prob with changes on internal structures which will be public for 'hardcore' PB programmer...
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

IceSoft wrote:
freak wrote:We do not publish any internal structures anymore because it limits our ability to further improve PB, as we cannot even change our internal stuff without breaking user code.
Come on @freak...this argument is also old...and not true. Have a look on the public command which will be changed with PB4.30. No prob for us.
I belive we have also no prob with changes on internal structures which will be public for 'hardcore' PB programmer...
+1
We know what we're doing. If we're using internal structures, it's not to do retro compatibles things; it's only for really specific stuff, generally to have a specific platform pointer (like a DC), or things like that. When I see this kind of code, I know that I have to be careful. I hate too seeing this kind of code without a notice on the special nature of these hacks.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

> We know what we're doing.

That may be true for you, but in the past a lot of code using internal stuff ended up in the forum without any explanation, and a lot of people simply used them and then wondered why they stopped working at some point. In reality, every incompatible change will affect someone, no matter how often you declare it "internal".

And even if we made future changes without regard for compatibility. We would still have to document every change properly, and announce/explain the changes with every new release. With the vast number of PB libraries available today, and the many differences between the OS and processor platforms this amounts to a huge amount of work. Thats just too much work only so that a few people can hack around with the internals.

If you have a specific project for which you need PB internal information, you can always ask us privately and we may provide the information, but we are not going to document all this publicly, as this kind of defeats the purpose of an "internal data structure" ;)
quidquid Latine dictum sit altum videtur
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

freak wrote:If you have a specific project for which you need PB internal information, you can always ask us privately and we may provide the information, but we are not going to document all this publicly, as this kind of defeats the purpose of an "internal data structure" ;)

It's OK for me :)
User avatar
IceSoft
Addict
Addict
Posts: 1683
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

freak wrote: If you have a specific project for which you need PB internal information, you can always ask us privately and we may provide the information, but we are not going to document all this publicly, as this kind of defeats the purpose of an "internal data structure" ;)
To you think this way is easier? Ok fine...hope you will not suffering in emails, pm or somethink.

I belive it es more easier to add it to the download page...so you can see who is downloading it.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Marco2007
Enthusiast
Enthusiast
Posts: 648
Joined: Tue Jun 12, 2007 10:30 am
Location: not there...

Post by Marco2007 »

Sorry for being off the topic:

@IceSoft: Please: Believe! ...just because you often use it.
PureBasic for Windows
User avatar
IceSoft
Addict
Addict
Posts: 1683
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

Marco2007 wrote:Sorry for being off the topic:

@IceSoft: Please: Believe! ...just because you often use it.
I do it. Belive me ;-)
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
X
Enthusiast
Enthusiast
Posts: 311
Joined: Tue Apr 04, 2006 6:27 am

Post by X »

Can we get the sprite3D structure at least? That way, for those of us who want to simulate lights with colored tiles. Right now we can only color the whole sprite, and not individual corners :) Maybe I am missing something :)
Post Reply