Page 1 of 5

Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Wed Feb 15, 2012 10:19 pm
by ts-soft
Description:
Small Drop-GUI to convert all binfiles to DataSection.
Preview of Pictures, Sounds can be played.
This tool should help you to post your sources without
dependencies, in this forum.
It's not designed to work with big files.
Tested on linux,macos and windows

Have fun

The source is to large, to post it here,
please download at: http://dl.dropbox.com/u/3086026/Bin2Data.pb

A version with better packsupport, but requires PB5.10 + can you found here:
http://www.purebasic.fr/english/viewtop ... 91#p411891

// added screenshot:
Image
Historie wrote:; V1.1z 2012/02/19
; version modified by Wilbert.
; - different handling of data generation
; - added control of quads per line
; - added zlib compression option
;
; V1.1, 2012/02/16
; small bugfix with drop folder or empty files
;
; V1.0, 2012/02/15
; Initial release

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Wed Feb 15, 2012 11:06 pm
by skywalk
Too Cool! 8)

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Wed Feb 15, 2012 11:41 pm
by rsts
Mr Soft, your contributions are outstanding.

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Thu Feb 16, 2012 1:20 am
by IdeasVacuum
Well, it does work OK with large files too, just leave to run during a coffee break. Took just over a minute to process an 886KB file (producing 22705 data lines!). So, kudos ts-soft. :wink:

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Thu Feb 16, 2012 5:39 am
by ts-soft
I thank you for the feedback

Update:
historie wrote:V 1.1, 2012/02/16
small bugfix with drop folder or empty files

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Thu Feb 16, 2012 5:58 am
by Little John
Very nice, Thomas. I need it right now. :-)

Thank you, LJ

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Thu Feb 16, 2012 9:14 am
by electrochrisso
Just what the doctor ordered.
Thank You! :)

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Thu Feb 16, 2012 2:06 pm
by flaith
Another awesome contribution of ts-soft :wink:
Thanks a lot :mrgreen:

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Thu Feb 16, 2012 3:53 pm
by KJ67
Nice one, thank you very much! :)


PS, you may want add "?dl=1" to the end of your dropbox link for us poor laze ones :wink: .

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Fri Feb 17, 2012 9:36 am
by wilbert
Nice work :)

I created a modified version that adds a control to set the number of quads per line.
To do so, the file is kept in memory and the data is (re)generated when requested.
It uses a different routine for the conversion to text that uses asm to make things a bit faster.
http://www.w73.nl/pb/Bin2Data_Mod.pb

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Fri Feb 17, 2012 9:43 am
by Torp
Many thanks !

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Fri Feb 17, 2012 10:04 am
by ts-soft
wilbert wrote:Nice work :)

I created a modified version that adds a control to set the number of quads per line.
To do so, the file is kept in memory and the data is (re)generated when requested.
It uses a different routine for the conversion to text that uses asm to make things a bit faster.
http://www.waterlijn.info/pb/Bin2Data_Mod.pb
Thx, nice and very fast addition! :D
I have add your mod to the official release.

@all
The first download is changed to the enhanced version from wilbert.

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Sat Feb 18, 2012 9:06 am
by wilbert
I added an option to try to pack the data using the PB compression algorithm so the data can be decompressed without external libraries.
http://www.w73.nl/pb/Bin2Data_Mod.pb
If it succeeds, the result shows both the packed and original size.
It's mainly useful for text files.

Example of how it can be used :

Code: Select all

If OpenWindow(0, 0, 0, 600, 300, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  EditorGadget(0, 10, 10, 580, 280)
  
  *Mem = AllocateMemory(1868)
  UnpackMemory(?Install_txt_start, *Mem)
  SetGadgetText(0, PeekS(*Mem, 1868, #PB_Ascii))
  FreeMemory(*Mem)
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

DataSection
  Install_txt_start:
    ; packed size : 1180 bytes
    ; original size : 1868 bytes
    Data.q $0000074C626C7A31,$2D57500A00100000,$5020200A0A000000,$6369736142657275,$4D2072002B6F6620
    Data.q $000A5820534F6361,$736E49202E4965E8,$74616C6C6100F874,$42865C40006E6F69,$76652065726F6665
    Data.q $6968747972000065,$20756F79202C676E,$742064028065656E,$006874203E69206F,$6C65766544206500
    Data.q $6F7420737265706F,$582820736C00006F,$7266202965646F43,$7070410000206D6F,$617661280A20656C
    Data.q $6500006C62616C69,$65206E61206E6F20,$0344432061727478,$7070696873202C00,$8468746977206465
    Data.q $187027726F20F080,$200000646440615E,$746973206265770A,$00632041202E2965,$6E61632079706F00
    Data.q $6E776F6420656220,$646564616F00006C,$7468206572656820,$3A2F2F3C303A7074,$6D6F6300002E4A2E
    Data.q $582F534C4F4F542F,$0A00002E65646F63,$6968742065636E4F,$006F642073692073,$202941013A656E12
    Data.q $201420676E697355,$4400E5498CC97469,$0179736165282045,$3120202F2940A400,$67617218A9442029
    Data.q $65726964C6000C28,$03772079726F7463,$2E746E6177469548,$293236000020200A,$2D656C62756F4420
    Data.q $F76B6320F0696C63,$6369FFC184273E27,$6C69778B00062C67,$68636E75616C206C,$7F2E454449690282
    Data.q $692480417FB17033,$08642072796F4A63,$7661680C6B636F10,$6D7265704E000065,$20796C746E656E61
    Data.q $6C61668020706F28,$02FD0042520A2E29,$006C616E696D7265,$206C6C6568732F00,$6569726570786528
    Data.q $752064656300386E,$D47F222973726573,$6F688E80546E690B,$293113163D00656D,$203C006E65704F20
    Data.q $6520646E61207261,$665372657418006E,$006E69776F6C6C6F,$62202420323A6738,$78650BE000687361
    Data.q $0055502074726F70,$4349534142455200,$2F7E3D454D4F485F,$8C62657275087C70,$243D485441280103
    Data.q $632F34A000243A05,$A072656C69706D6F,$6800115405327350,$696C203320657365,$202095352A80656E
    Data.q $049EA929612E5020,$696877202C392068,$61666D6F44606863,$72706F0222697270,$F888006588746169
    Data.q $20746C7561666564,$2820656E6F00110A,$2E03646C756F6873,$2E3046206E6F1BE6,$6102C033332E3031
    Data.q $2962A22965766F62,$662F74657318D020,$5981696699726176,$E1BC73202C07E850,$0A589816F02011F0
    Data.q $26BB4841776F6E6B,$6C20733010166F1C,$2029631380C76569,$37468A921F646461,$2503907AE1A5132F
    Data.q $4061656D05687461,$6168740A20736E01,$75636508007865F8,$6E756F662073A974,$50F198182D890A64
    Data.q $6560205B0665620F,$796E61AA418A0A20,$206669B69F1E84B3,$736B726F77B7C004,$6C450A64726F6320
    Data.q $307570ED094CDC79,$002E2F7EA0B2090A,$6C6966206372B700,$69666E6F63282065,$1C0008470CA12867
    Data.q $202E49490A0A0A29,$0A4F4B97BA707553,$7235004B66494731,$67005075622061D0,$657361656C70202C
    Data.q $A1CE746E139C514C,$677562011809EC1A,$006F209863657320,$6D75726F66D46673,$800AD56C2E7A9873
    Data.q $756F732061432053,$6E7320656304E572,$73656466A02C7459,$726540805E697263,$619904922E726F72
    Data.q $2F0100DA6D61796E,$2C74736567677573,$206C650121656620,$736F70BC65657266,$2073616D65212400
    Data.q $54B56C59816C6577,$614E80146B6E6168,$31E02120746F6C20,$6500006854000316,$736961746E614620
    Data.q $0074666F53206569,$6554206572617700
    Data.b $61,$6D,$2E,$0A
  Install_txt_end:
EndDataSection

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Sat Feb 18, 2012 9:45 am
by electrochrisso
This will be good for custom rtf style help files, I think. :?:

Re: Bin2Data - Crossplattform DataSection Maker, OpenSource

Posted: Sat Feb 18, 2012 10:50 am
by ts-soft
wilbert wrote:I added an option to try to pack the data using the PB compression algorithm
Thx, but i will not add this to official, the packroutines in pb not crossplattform-compatible in result :cry: