Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - waste

Pages: [1]
1
hi all,

i send you a single Exe Patcher source where i 'm trying to display starfield effect into a window with gadgets,

i can't manage to have all the stuff at same time,

i know how to use EP_fxlib to display starfield  with MP_Graphics3DWindow but not with OpenWindow()  and OpenWindowedScreen()

in capture1 , you can see my main windows with an openwindowedscreen where i want to display stars ....

if i take out comments  before MP_RenderWorld() and MP_Flip ()       i obtain an invalid memory access

thanks for your advices

in this code, you have also an example to extract a .mp3 sound from DataSection and use it with FMOD without dropping on the disk , can be usefull

Code: [Select]

IncludeFile "fmodex-min.pbi"

#FMOD_OPENMEMORY  = $00000800


Enumeration
  #chiptune
  #scroll
  #wmain
EndEnumeration

Structure FMOD_CREATESOUNDEXINFO
  cbsize.i     
  length.i       
  params.i[32]   
EndStructure

Global fmodsystem.i, Channel.i, i.i, j.i
Global Dim Sounds(1)
Define szFile.s
Define szOut.s
Define dwSize.l
Define lFF.l
Define Text_offsetV.i

InitSprite()
EP_InitFXLib()



OpenWindow(#wmain,150,50,500,360,"Single .EXE Dynamic patcher Jmg@2017 Esc to quit", #PB_Window_ScreenCentered)
;MP_Graphics3DWindow(150,50,50,30,"Metasploit Meterpreter Dynamic patcher Jmg@2017 Esc to quit", #PB_Window_ScreenCentered)

SetWindowColor(#wmain,RGB(14, 10, 100))

OpenWindowedScreen(WindowID(#wmain),10,120,480,180)


Text_File = TextGadget(#PB_Any, 150, 15, 290, 20, "", #PB_Text_Border)
Text_f1= TextGadget(#PB_Any, 50, 20, 30, 20, "File")
SetGadgetColor(Text_f1,#PB_Gadget_FrontColor,RGB(154, 154, 154))
SetGadgetColor(Text_f1,#PB_Gadget_BackColor,RGB(14, 10, 100))


Text_offsetC= TextGadget(#PB_Any, 50, 50, 90, 20, "Decimal Offset :")
SetGadgetColor(Text_offsetC,#PB_Gadget_BackColor,RGB(14, 10, 100))
SetGadgetColor(Text_offsetC,#PB_Gadget_FrontColor,RGB(154, 154, 154))

Text_offsetV= EditorGadget(#PB_Any, 150, 45, 90, 20)

Text_valueC=TextGadget(#PB_Any, 50, 80, 90, 20, "Decimal Value :")
SetGadgetColor(Text_valueC,#PB_Gadget_BackColor,RGB(14, 10, 100))
SetGadgetColor(Text_valueC,#PB_Gadget_FrontColor,RGB(154, 154, 154))


Text_valueV =EditorGadget(#PB_Any, 150, 75, 90, 20)
Button_SelectFile = ButtonGadget(#PB_Any, 50, 320, 140, 20, "Select File")
Button_PatchFile = ButtonGadget(#PB_Any, 310, 320, 140, 20, "Patch File")


EP_Init2DStars(200,7,1.3,0,0,640,480)
EP_2DStarsColor(1,RGB(255,0,0))
EP_2DStarsColor(2,RGB(0,255,0))



Procedure FMOD_DataSectionLoadSound(SoundId, SoundLocStart, SoundLocEnd)   
  Protected exinfo.FMOD_CREATESOUNDEXINFO
 
  exinfo\cbSize = SizeOf(FMOD_CREATESOUNDEXINFO)
  exinfo\Length = SoundLocEnd - SoundLocStart
 
  FMOD_System_CreateStream(FmodSystem, SoundLocStart, #FMOD_SOFTWARE | #FMOD_OPENMEMORY, @exinfo, @Sounds(SoundId))
EndProcedure



Procedure.l Patch(file.s,location.l,byte.b)
  If OpenFile(0,file)
    FileSeek(0,location)
    WriteData(0,@byte,1)
    CloseFile(0)
    ProcedureReturn 1
  EndIf
EndProcedure





;----------------Init sound First Part-------------------------------------------------
first:

FMOD_System_Create(@fmodsystem)
FMOD_System_Init(fmodsystem, 32, #FMOD_INIT_NORMAL, 0)
FMOD_DataSectionLoadSound(0, ?chiptune, ?endchiptune)

FMOD_System_PlaySound(fmodsystem, #FMOD_CHANNEL_FREE, Sounds(0), 0, @channel)





Repeat
 
  ;event=WindowEvent()
  ; EP_2DStarsDraw()
  Select WindowEvent()
     
    Case #PB_Event_Gadget
      Select EventGadget()
         
        Case Button_SelectFile
          szFile = OpenFileRequester("Select file to patch", "", "*.*", 0)
          If szFile
            SetGadgetText(Text_File, szFile)
          Else
          EndIf
         
         
        Case Button_PatchFile     
          offValue=  Val(GetGadgetText(Text_offsetV))
          byteValue = Val(GetGadgetText(Text_valueV))
         
         
         
         
         
         ; Debug offValue           
        ; Debug byteValue
         
          Patch(szFile, offValue, byteValue )
         
         
          MessageRequester("Info"," File patched successfully ! ...")
         
         
         
         
      EndSelect
  EndSelect
 
 
  ;MP_RenderWorld()
  ;MP_Flip ()       
 
Until GetAsyncKeyState_(#VK_ESCAPE) 



DataSection
  chiptune:
  IncludeBinary "chiptune1.mp3"
  endchiptune:
EndDataSection






2
Purebasic / [Retroremake] Amstrad CPC for fun
« on: October 13, 2017 »
hi,

a very simple retroremake of the second demo by Logon System,

yes, i know, you won't learn anything with this code, it's for fun

no exe compiled, diy

if you know a way to rip font stuff from Amstrad it interests me ! you can see looking to the scrolltext that i find a dirty way to implement it !


original : https://www.youtube.com/watch?v=VBMEDJZ46zc

Code: [Select]

; Retro remake Démo n°2 Logon system @mstrad CPC 1988
; jmg@2017

Enumeration
  #scroll
  #chiptune1
EndEnumeration 

;-------------------------------Init---------------------------------------

InitMovie()
InitSprite()
EP_InitFXLib()
UsePNGImageDecoder()

text.s ="                                                             salut tous, petit retroremake purebasic Amstrad cpc " +
        "de la demo numero deux de  logon system je n'ai pas repris le texte du scrolling car trop long a taper de plus a cette epoque " +
        "le texte ne servait qu a illustrer les capacites techniques du scrolling la par exemple je fais du remplissage pour que vous " +
        "puissiez apprecier la musique qui d apres l auteur certaienement serge alias longshot est du jeu rampage "+
        "en fait c est rampart ce qui est pareil que rampage mais avec des chevaliers a la place des dinosaures bref "+
        "je vais m attaquer a un peu plus technique comme retroremake la prochaine fois j en profite pour remercier google " +
        "de m avoir supprime mon compte developpeur pour des raisons obscures  ce jour     c est pas demain que je vais faire " +
        "fortune avec mes applis android    pas grave l espoir fait vivre             "

MP_Graphics3D (759,545,0,1)
SetWindowTitle(0, "Logon Sytem démon N°2 1988 JmG@2017")

EP_CatchFont32(0,?font,?endfont-?font)

EP_SetScrollText(0,text )
EP_Create32Scroll(0, 0, 0, 485)
EP_SetScroll32Speed(0, 8)

LoadMovie(#chiptune1,"chiptune1.mp3")


one = MP_CatchSprite(?sprite,?endsprite-?sprite)
PlayMovie(#chiptune1,1)


Repeat
 
  event=WindowEvent()
 
  MP_DrawSprite(one,0,0)
 
  EP_Move32Scroll(0)
 
  MP_RenderWorld()
  MP_Flip () 
   
Until GetAsyncKeyState_(#VK_ESCAPE)



DataSection
  sprite:
  IncludeBinary "scr1.png"
  endsprite:
  chiptune:
  IncludeBinary "chiptune1.mp3"
  endchiptune:
  font:
  IncludeBinary "fnt.bmp"
  endfont:
EndDataSection


; End PB
; PureBasic 5.42 LTX (x86)



3
Purebasic / timing effects / music
« on: June 09, 2016 »
hi all,

i managed to use the PurebasicUserlib by eNeRGy/dAWN PtkRplay in order to play / locate postion , row  with ptp music modules

i would like to start scrolltexts, rasterbars , all graphical stuff based on music rythm , 

how do you deal with that in your intros / demos  ? using timers ?

i tryied with conditions like 

Code: [Select]
If Ptk_GetPosition() > 1 And Ptk_GetRow() =1
drawstars()
EndIf

but it's getting hard when adding more effects ... , i use Mp3d lib and EP_fxlib ,

i can have rasters/ sinusscroll / starfield simulteanously , without trying to set them on music ,

for example , my main loop  looks like that

Code: [Select]
Repeat
  event =WindowEvent()
 
MP_AmbientSetLight (RGB(0,0,40))

EP_Move32Scroll(0)
EP_2DStarsDraw()
EP_DisplayRasterBar(0,30)
EP_DisplayRasterBar(1,450)

Until GetAsyncKeyState_(#VK_ESCAPE)


scroll , rasters and stars must be in a loop ,

so i tried  :
Code: [Select]
Procedure DrawStars()
 Repeat
    event=WindowEvent()
   
    EP_2DStarsDraw()
   MP_RenderWorld()
  MP_Flip ()       
    Until Ptk_GetPosition() =20
  EndProcedure


when ptk position is = 20 , stars don't stop ...  and if i set a scrolltext to start at postion 3 , i think it starts but no display ( to much MP_Flip() perhaps

so i don't know wich way i should choose,   select/case  , While / wend ? ......

4
Purebasic / intros/demos sound Vumeter
« on: June 03, 2016 »
hello ,

i'm looking for a hint to start coding a sound vumeter for my intros , i don't know how to do that , hooks ? or simply adapt timers on sprites display to make vumeter based on music rythm ??

thanks 

5
Purebasic / raster bars + stars = freeze !
« on: May 24, 2016 »
hi all,

i'm trying to display simulteanously raster bars and starfield with camera effects,

after 5 seconds, my app get frozen, i have already met this but i ve forgotten how to fix it !!   :clap:  debugger end unexpectedly ...

win 8.1 Enterprise 64
PB 5.31 (official)

here is my code if you hav any idea ....

Code: [Select]

;
; starfield credits unknokwn
;
; rasters credits : padman and inc. , many thanks dudes



Enumeration
#win
EndEnumeration

#scrw = 640
#scrh = 502
#centerofscrw = #scrw/2
#centerofscrh = #scrh/2


SSum.w = 5000 ; nbr of Stars


Cspeed.f=10
CameraZ.f=0

xres  = 640           ; ScreenWidth
yres  = 502           ; ScreenHeight


InitSprite()
InitKeyboard()
UsePNGImageDecoder()


Gosub InitStarField


If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
 MessageBox_ (0,"Can't open DirectX 7 or later", "blahhhh", #MB_ICONINFORMATION|#MB_OK)
End
EndIf

OpenWindow(#win, 0,0,640, 502, "Yep !" , #PB_Window_SystemMenu|#PB_Window_BorderLess |#PB_Window_ScreenCentered )
OpenWindowedScreen(WindowID(#win),0,0,640,502)

 

SetFrameRate(90)

 StartDrawing(ScreenOutput())
 For y = 0 To 32
   
    Box( 0, y, 640, 64 - y*2, RGB(y*6, 35, 65) )
   
 Next y
 StopDrawing()
 
 GrabSprite(1, 0, 0, 640, 64)
 
 
 
;-------- MainLoop --------
Repeat
 
ExamineKeyboard() 
ClearScreen(0)
StartDrawing(ScreenOutput())

Gosub DrawStarField
Gosub MoveCamera

StopDrawing()

DisplaySprite(1, 0, 36 + 8*Sin(r.f))           ; 36 to set it up on screen and *sin for amplitude
DisplaySprite(1, 0, 136 + 50*Sin(r + 1.57))
DisplaySprite(1, 0, 236 + 8*Sin(r + 3.14))
r+0.085


FlipBuffers()

Until KeyboardPushed(#PB_Key_Escape)
End

;--------- Procs / Subs -------------

InitStarField:

Structure _3DStar
x.f ; X-Coordinate
y.f ; Y-Coordinate
z.f ; Z-Coordinate
EndStructure


Dim Stars._3DStar(SSum)
For strtpoint = 0 To SSum
Stars(strtpoint)\x = Random(10000)-5000
Stars(strtpoint)\y = Random(10000)-5000
Stars(strtpoint)\z = 100 + Random(1000)
Next strtpoint
Return



MoveCamera:
If CameraZ>1000
  Direction=-1
ElseIf CameraZ<-1000
  Direction=1
EndIf

If Direction=1 And Cspeed<10
  Cspeed=Cspeed+0.01
ElseIf Direction=-1 And Cspeed>-10
  Cspeed=Cspeed-0.01
EndIf
CameraZ=CameraZ+Cspeed
Return


DrawStarField:
For strtpoint = 0 To SSum
If Stars(strtpoint)\z<CameraZ
  Stars(strtpoint)\z=CameraZ+1000
  ElseIf Stars(strtpoint)\z>(CameraZ+1000)
  Stars(strtpoint)\z=CameraZ
EndIf

SX = Stars(strtpoint)\x / (Stars(strtpoint)\z-CameraZ)*100+#centerofscrw
SY = Stars(strtpoint)\y / (Stars(strtpoint)\z-CameraZ)*100+#centerofscrh

If SX<#scrw And SY<#scrh And SX>0 And SY>0
  b.f = 255-(((Stars(strtpoint)\z)-CameraZ)*(255./1000.))
  c=Int(b)
  Plot ( SX, SY, RGB(c,c,c))
EndIf

Next strtpoint
Return





6
C / C++ /C# / Allegro help !
« on: February 17, 2014 »
hi all ,

I'm begginer in demoscene effects ( though i used to do that on z80 assembly ...)  , 

i'm trying to merge two source code i 've found ,  one starfield and  one scroller text (no sine first) , using allegro for both

the two codes compile and execute well, but when i want to insert my scroller text with the starfield , the program stops ,

i can provide source code by mail or mp,  here are sections  i suppose that cause the crash,  (when i put the line "problem 1,2,3" in comments , text scroller runs without starfield )   

sorry for my english ... i hope it's quite correct

Main function

Code: [Select]
int main(int argc, char *argv[]) {
 
    int framecount;
    framecount=0;
 
    allegro_init();       
install_keyboard();   
 
    LOCK_VARIABLE(speed_counter);
    LOCK_FUNCTION(increment_speed_counter);
    install_int_ex(increment_speed_counter, BPS_TO_TIMER(60));
 
set_color_depth(8) ;   // 8 bit colour
if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, screen_x, screen_y, 0, 0)<0)
{
    //set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); 
    set_gfx_mode(GFX_AUTODETECT_WINDOWED, screen_w, screen_h, 0, 0);
 
     allegro_message("Failure to init video mode!\n%s\n", allegro_error);
    exit(1); // force abort
}
 
  off_screen = create_bitmap(screen_x, screen_y); 
 
 
  Init_Music();
    Init_Font();
    install_timer();
    Play_Music();
    srand(time(NULL));
Star star[maxstars];     // problem one !
 
 while ((!key[KEY_ESC])&&(!key[KEY_SPACE]))
    {
 
        clear_bitmap(off_screen);
 
 
 
 
 
        DrawString((framecount % 2550)-820,508,"TEST SCROLL LEFT TO RIGHT...NO SINUS EFFECT FIRST....");  // draw scroller
        framecount+=6;
        vsync();
       blit(off_screen, screen, 0, 0, 0, 0, screen_x, screen_y); 
        rest(1);
    };
    while(speed_counter > 0)
        {
         for(int i = 0; i < maxstars; ++i)
                            {
                                    star[i].movestars();                // problem two !
                            }
                            speed_counter --;
         }
 
        draw_sprite(screen, buffer, 0, 0);       // third problem , linked to the Star Class, supposed to draw starfield
 
 
    destroy_bitmap(off_screen);     
    Kill_Music();
    Kill_Font();
    remove_timer();     
return 0;     
}     
END_OF_MAIN();


here is the Star Class that causes problems

Code: [Select]

 
Star::Star()
{
            posx = (rand() % screen_w);
            posy = (rand() % screen_h);
            speed = (rand() % 5) + 1;
            putpixel(buffer, posx, posy, makecol(255, 255, 255));
 
void Star::movestars()
{
          putpixel(buffer, posx, posy, makecol(0, 0, 0));
          posx -= speed;
          if (posx <= 0)
          {
             posx = screen_w;
          }
          putpixel(buffer, posx, posy, makecol(255, 255, 255 ));
}

thanks in advance for your advices



Pages: [1]