elbereth / DragonUnPACKer

Free/Open source game file resource explorer/unpacking tool made easy!
https://www.elberethzone.net/dragon-unpacker.html
178 stars 21 forks source link

Lazarus port #181

Open halamix2 opened 4 years ago

halamix2 commented 4 years ago

Not an issue per se, just to mark problems/progress, pull request in next week or two

I was able to compile and run it under Linux with these changes( surprising, given integration with Windows API and registry)

It compiles and runs under Windows XP

It still gives access violation at boot, but the main window appears.

DPlugins.refreshDrivers(): when file doesn't exist test equals 0, and func tries to load nonexistent file

test := SafeLoadLibrary(path+'/plugins/drv_default.d6d');   // returns 0 if file doesn't exist
func := TProcGetDUDIDriver(GetProcedureAddress(test,'getDUDIDriver')); 
Logger.Send('Test',test);
  if (@func = nil) then
    Logger.Send('Test ERROR')
  else
    Logger.Send('error right here');
    test2 := func();      
    //...

After copying drv_default.d6d to correct location SIGSEGV is gone. Possible solution would be to check if test = 0 and then try to load library (actual sigsegv was caused by test2 := func() line)

Notes: ~I use Lazarus from Ubuntu 19.10 distro, which have some known issues, I'll need to try official Lazarus release to see if this fixes anything for me~ I use Lazarus 2.0.6 compiled from source, works fine now

halamix2 commented 5 months ago

Quick and dirty updates made to get it compiling under latest Lazarus on Linux: https://github.com/halamix2/DragonUnPACKer/tree/lazarus-rewrite-cleanup path joins should be platform independent in the future

halamix2 commented 5 months ago

Progress of the core port: https://github.com/halamix2/DragonUnPACKer/tree/lazarus-rewrite-core (Diff: https://github.com/elbereth/DragonUnPACKer/compare/master...halamix2:DragonUnPACKer:lazarus-rewrite-core)

TODO:

halamix2 commented 5 months ago

I've forgot to ask, and keeping compatibility is tedious: @elbereth, if I'm trying to port all subprojects to Lazarus I don't need to keep compatibility with Delphi 7, right? I'd rather not put {$ifdef FPC} everywhere :P

elbereth commented 5 months ago

By all means! If we can get rid completely of Delphi it would be a win. Newer versions of Delphi are probably not compatible with the current code anyway and the Delphi 11 community edition has no command line compiler or cross-platform support. The Pro version is just too expensive for a free software.

elbereth commented 5 months ago
* [ ]  fix `?.?.? Missing VersionInfo (Build 0)` / `git commit $Rev$`

Currently I use an external PHP script to fill this before compile. I recon it would be best if it can be done via Makefile but I never dug into this.

* [ ]  check if changing build time to `GetExecutableCompilationDateTime` is the best solution here (it is cross-platform, but does it update on each build?)

I think it would be best if it stays at commit time but could be an alternative if easier.

* [ ]  convert rest of tools

Duppi would be the hardest but I already have an almost funcional Lazarus rewrite from 10 years ago.

* [ ]  check what is outdated and can be removed (fastmove, xpman, maybe some of the Win7-specific components?)

This is what is most dreading... Most features are outdated and need to be re-thought. Make use of modern Windows features. Change file type associations (I don't think the old method works in modern Windows). If we want to be able to use the tool in command line for example. The executable probably needs to be signed to avoid the warning in Windows.