121
Purebasic / Re: Sync - Fire and Forget Cracktro remake
« on: March 20, 2018 »
I know the original music came from the game Thrust but i'm not sure which demo it was in. Time to start delving...
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.
Enumeration
#wmain
EndEnumeration
Define szFile.s
Define Text_offsetV.i
InitSprite()
OpenWindow(#wmain,150,50,500,360,"Single .EXE Dynamic patcher Jmg@2017 Esc to quit", #PB_Window_ScreenCentered)
SetWindowColor(#wmain,RGB(14, 10, 100))
StickyWindow(#wmain,1)
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")
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
;-======================= Starfield Code ====================================================
Procedure Draw_Threaded(T)
Repeat
;KK_DrawStars2D(0.05) ;minus =left
KK_DrawStars3D(-0.05) ;-only use minus values for 3D
ForEver
EndProcedure
canvwidth=480
canvheight=180
CanvasGadget(1,10,120,canvwidth,canvheight)
;KK_InitStars2D(250,1) ;-number of 2D stars
KK_InitStars3D(1000,1) ;-number of 3D stars, canvas number
CreateThread(@Draw_Threaded(),0) ;-draw it inside a thread. You can use BindEvent but it does flicker a bit.
;-==========================================================================
Repeat
Delay(1) ;-give some time back to other windows.
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))
Patch(szFile, offValue, byteValue )
MessageRequester("Info"," File patched successfully ! ...")
EndSelect
EndSelect
Until GetAsyncKeyState_(#VK_ESCAPE)
Hi,
If i open the .pb file and then it say: it does not support compressed libraries. OSMELibrary if i copy it to purebasic userlibrary?
Best regards
Speedhead of Mjau64 / Byterapers