Showing posts with label Siege of Avalon. Show all posts
Showing posts with label Siege of Avalon. Show all posts

Thursday, 14 October 2021

A Taste of WINE

- or how to detect if your Windows application is run under a flavor of WINE

It has been a while since I mentioned what has been going on with Siege Of Avalon - and the short story is that I have been involved in getting the game re-released on GOG and Steam - the long story deserves a longer post another time.

We currently have a bigger update/patch planned - that would be the 4th - since its re-release in April 2021 - but it is not finalized what goes in and what not.

But one of the minor things, is trying to make the game more Steam Play friendly - so that basically just allowing custom ddraw.dll and disabling a few things when run under Wine/Proton - so that the game is playable without the need to jump through hoops like winetricks and  protontricks.

Since these compatibility layers are meant to be transparent to the windows application, one would need to actually in some detect if running under Wine, luckily there is an extra bit in the NTDll.dll - the wine_get_version function.

So dynamically loading of the Dll, and try to get the address pointer of the function will reveal if your plain Delphi VCL Windows is run under Wine on Linux (or other Wine supported platforms).

The code for the simple test pictured:

procedure TForm10.Button1Click(Sender: TObject);
var
  dll: HMODULE;
  get_WINE_version: function: PAnsiChar;
begin
  dll := LoadLibrary('ntdll.dll');
  if dll<>0 then
  begin
    @get_WINE_version := GetProcAddress(dll, 'wine_get_version');
    if Assigned(@get_WINE_version) then
      Label1.Caption := 'Running under ' + get_WINE_version()
    else
      Label1.Caption := 'Pure ol'' Windows';
    FreeLibrary(dll);
  end;
end;

This is by no means the real deal, but if it helps bringing an existing application run on a different platform and making it aware of that - then it might be helpful.

A more "correct" way to migrate existing VCL applications could be https://www.crossvcl.com, but in this case that is not doable - since not a standard Delphi VCL application.

But as you can see below this detection short-cut can help create an experimental build of Siege Of Avalon that is running on Steam Play out of the box. AS-IS.

Siege of Avalon launched under Steam Play on Linux - also showing the new live-mapping.

Please support the nice publisher of this re-released classic old game, and their willingness to keep releasing the Delphi code of the GOG/Steam releases.

/Enjoy

Wednesday, 12 June 2019

Bringing the POX cross-platform

- or a few things on the extended RTTI and new inline variables presented in 10.3.



Having figured out the internals of the POX file format used in the game Siege of Avalon, and it's sibling from the modding community: Ashes of Avalon, Pillars of Avalon and Days of Ahoul to name the larger ones - enables to revise the tooling used for the engine - most of it closed source or requiring jumping through hoops while juggling.

So the first thing I brewed together is a POX file viewer/player with an export function. A preliminary test was done in the previous post, but I redid it using the FMX multi-device UI framework that comes with RAD Studio/Delphi/C++Builder - so that modders using for instance macOS, do not need to run in a virtual OS - and it all comes for "free" when using FMX.

Saturday, 8 June 2019

Cure for POX found in Avalon

- or how reverse engineering makes a game engine portable.



One thing that can stop software from being portable and surviving the decay of time, is when closed and proprietary file formats block any chance of progress - the game Siege of Avalon has the POX.

Saturday, 23 March 2019

Siege of Avalon lifted

- or an example of migrating old source code to newer grounds.

Compiled with latest Delphi (10.3.1 Rio) - Nice inventory graphics.

This post is just about the few steps I did on migrating the Delphi 4 source of Siege of Avalon to Delphi 10.3.1, and the intentions and road-map I have proposed to the players and modders of this nice game.