Author Topic: can we reverse engineer an old build that I lost the source files?  (Read 1263 times)

dpjpandone

  • Senior
  • ****
  • Posts: 408
Can we do this? I no longer have the laptop I was using for development a few years ago, but I DO have the test builds that I published at the time. Is there a way to extract the source from one of those test builds?

petabyte

  • Member
  • ***
  • Posts: 105
Re: can we reverse engineer an old build that I lost the source files?
« Reply #1 on: November 17, 2022, 05:02:59 PM »
You couldn't get the source code. You might be able to throw it in Ghidra and use that to help you rewrite the code.

names_are_hard

  • Developer
  • Hero Member
  • *****
  • Posts: 715
  • Dev: 200D, 750D, 850D, 7D2
Re: can we reverse engineer an old build that I lost the source files?
« Reply #2 on: November 17, 2022, 08:19:27 PM »
It might be possible to get the source.  The mercurial build system logged source code changes as part of the build, and copied them into one of the binaries.  I haven't worked with this in much detail and can't remember the limitations.

See parts in the make system around "version.bin", there's some hg logging command that creates it.

dpjpandone

  • Senior
  • ****
  • Posts: 408
Re: can we reverse engineer an old build that I lost the source files?
« Reply #3 on: November 17, 2022, 09:59:02 PM »
It might be possible to get the source.  The mercurial build system logged source code changes as part of the build, and copied them into one of the binaries.  I haven't worked with this in much detail and can't remember the limitations.

See parts in the make system around "version.bin", there's some hg logging command that creates it.

so I actually found the Hard drive with my old source today!!!! BUT!!!!

All the files are gibberish!

for example, here is the content of my old features.h:

Code: [Select]
(ØߐTã ¶)šõѶ¾ÑÑóúvŽâ£³?Ê^•Ú#]1íüË™H”ð}]
‡w%?¬°Ã]ýv‹öI9ÑTWssÿ6úÜSç
r¡m×·¤÷£oÅ\vY=†–ê“Ü&G“ÿµ>*œ¯‰i‰ Ë ßy•6>âfÁáù€E«é¿Jc‰[Ú†ºx/JÏÆÝXDÓ…*õõ-2Q@ÿý$WxèÒhéihÌê
:¶“ÒObhS×#¦ü›½Æ’×/qî¿™2MAÀD‡/ÙÕÜùX#ˆë…:Ζ»àwÏ1«A. b‘c¸[dçm¸+ÙÃHP,û™à’·Tþ¥ƒ1g
Ä0ɉ÷hñš ®˜÷
Üê÷¨bSœ} 139÷[ò)—¼w°®ë&ú§§o|¤ÏÁÕCЂN»Øo°„ÄØ;‚\”}ïÖW9WS×0±Ò;æ)”¬äiCÿh:ĉø¨{ æàH\UußáÉÿ•±Cº<ÓfKw!0ÝÒ~µ‰^‚õ9$·Ýøös71Š
­°qÂ
-ûØ)ñÐv‰\0žb‡ÏÎk¢d°1}!åeï÷Õ‹lŒãÐËQ»o¯¸PªI`ˆRi>-ÈìD Z•JdÑAE"t‰%k»‰ ¨¬"{¸F[øÏÛYÍ»7Dñë&AV‹ÒH#7Kšyõ]mËñ-7ˆ±ž8}ø¸ç€ ‰Ê!"L–š:
[K)‚öLæuévó<K¨²›ÞPõ’ÌãÇ„¨Ý—zÑkô³M¶uÛ+JKl´âÈÆsºšÒ4W,J#™×ºˆÿfL^?ÓIJ÷Ÿl² N°Ž ˆŽÛí4 —Þ°ªòd:5q¼[¬$ä¹›}[Y|D¨f<κ‹Ÿ¨&øiPÛø« Iì3ZÍq%À6â‡dCÛ)(Â2E±J½]çÞç_{êÞ iväµïÄî+äZDìË:2t3åußeD"Ž3¶O”¼´XidÙÙ i§é2©´RwèÏÄ?ÃuM c9¨Ÿ¡cÎ’m†§¥Ï՝kS'—ðb'½çIȉ½ûÚSóZOÁû èúÙ¶ ëÊsRbã8"@‡ Øèø¥`.>id, »³hÄÔ ²{>ù*ÝŒÖW ÂpZ7üÍc[á¹òv±6uŠÑ)~‚îð"¶ª?TÑ.;úkÀ•ÿç
©©¶Ã,Xf‡(MÙþŸœ!ÕeƒÄ^×—Žÿ!;öÈÃÇ£7ˆ6·IbËqçO®w²mNè¶‹‡ø¾1™¾’liÛ5œÉ&SÔÇ-­Q𺮻ÝÕYÞD7Üú‘U&#ø`«T!±Áy€º¯ú®¯˜¨Ö\ø(ÙòŒ 29é~ùüZ­QO«h1q%ÜI¾Â(I
i!ñ=¢1„XÏ2¤\F}iOæÊ‚›Eª8¸|ٍÁc¤[È—n–Üy8ù/àNô¼½Ük€jÓF#°Ç×#niÃqàGç¥â¸õnfi)`-9
 &¹ï$ej¾ÐN¶ 9ø²|„üÐúê‰ÁÕ†Ç=YX"§…$0O=Íó’Éðâa¦Ñ5с£âÝ›~ÜÓ.¤ý§¨‰R[ßW3·;êï³ñ¸õQå Yúi
Œ9§‘ŽÈíë©]7Í~N‘ÛúÁGÃÆŽË 9kçØg8¿Ý@#ÕLwUUO-›‚Bû9}è¢z®­ê£cV´àd8¹"nt•À–®5y-U1«,_5¶SÕWBŒ áu=duâ<Ç*„Rƒ¥?
vu”s±‡ŠJÎ8 *Uþ=Cçá?3/‚pót,ü¶tÉL²¾brgwå´nŒÂ1Ý·OùL’¨tt¸UuÈa îçCp×{cþä%¿ÀG¡BL³§“ÁÉ’²Ð0D]f ÙEó}S¡´ðŒñÆŸ2|¾b¼ŽìæžÉ~å‡8<7pjÈÐÂÔ$’šÁ{9yQ‹Ñ˜ÂxãÜáÝßüÁÚÛ­™Ý!C|£Ã[gŸ6³£:WâßkÒþ1Ñ?¸½8Çn*´‰Âzà(¼‘”mb¼) €ñùB¹&<0âŽ`á ßÎHDÄœI;»lâ…Äý.*æA´ð8§Låß5ù!Å¡x_a
Bx,b¦<

I think that old hard drive has seen better days.

It's so fucking weird because all my arduino sketches and sqjpegs and stuff are fine, wtf happened to my ML files?

any advice for recovering these files?

names_are_hard

  • Developer
  • Hero Member
  • *****
  • Posts: 715
  • Dev: 200D, 750D, 850D, 7D2
Re: can we reverse engineer an old build that I lost the source files?
« Reply #4 on: November 17, 2022, 10:28:28 PM »
Travel back in time and use a source control system.

You might be able to pull stuff out of hg's log, if you used that locally.  Repairing files is unlikely.  Some filesystems allow reverting to earlier versions but this is rare.  Maybe disk repair tools will help, this depends a lot on filesystem, OS etc.