Recent

Author Topic: Pac-Mac: a clone of the original game  (Read 2744 times)

Roland57

  • Hero Member
  • *****
  • Posts: 557
    • msegui.net
Re: Pac-Mac: a clone of the original game
« Reply #45 on: February 03, 2026, 07:28:17 pm »
Thanks again to Fred vS, Nimbus and Roland for their help !

You're welcome. Great! I will try the new version ASAP. (Until now I didn't manage to get sound.)
My projects are on Codeberg.

Lulu

  • Sr. Member
  • ****
  • Posts: 399
Re: Pac-Mac: a clone of the original game
« Reply #46 on: February 03, 2026, 09:54:58 pm »
It's mostly for fun; your ALSound works perfectly (but OpenAL requires many dependencies that can't be easily loaded dynamically under Unix, for example on my Ubuntu Noble, I needed to install libsndfile with :
Code: Pascal  [Select][+][-]
  1. $ sudo apt-get install libsndfile-dev
otherwise ALSound can not load it, even if dynlibs.LoadLibrary('path-to-libsndfile.so') is used.)
previously, ALSound can not load libsndfile because it have a dependency to flac library. If flac is not installed on the system, the load fail. Now, I've recompiled libsndfile.so without dependency with a script found on https://github.com/bastibe/libsndfile-binaries
Code: Pascal  [Select][+][-]
  1. lulu@lulu-virtualbox:~/Documents/Pascal/PacMan-main_ALSound/Binary/x86_64-linux$ ldd libsndfile.so
  2.         linux-vdso.so.1 (0x00007acb36eab000)
  3.         libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007acb36e85000)
  4.         libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007acb36d95000)
  5.         libmvec.so.1 => /lib/x86_64-linux-gnu/libmvec.so.1 (0x00007acb36905000)
  6.         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007acb36600000)
  7.         /lib64/ld-linux-x86-64.so.2 (0x00007acb36ead000)

Quote
I created an issue (which I closed because it wasn't a issue): https://github.com/Lulu04/PacMan/issues/1 regarding the use of uos as an optional audio engine.
You've done well. I've downloaded the project into a VM lubuntu 24.04 and try it, the sound don't work. UOS fail to load LibPortaudio-64.so because it have a dependency to the Jack library that is not installed on my system:
Code: Pascal  [Select][+][-]
  1. lulu@lulu-virtualbox:~/Documents/Pascal/PacMan-main_Uos/Binary/libuos/Linux/64bit$ ldd LibPortaudio-64.so
  2.         linux-vdso.so.1 (0x00007de1dd56b000)
  3.         librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007de1dd4dd000)
  4.         libasound.so.2 => /lib/x86_64-linux-gnu/libasound.so.2 (0x00007de1dd3cd000)
  5.         libjack.so.0 => not found
  6.         libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007de1dd2dd000)
  7.         libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007de1dd2d5000)
  8.         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007de1dd000000)
  9.         /lib64/ld-linux-x86-64.so.2 (0x00007de1dd52d000)

May be I miss something ? libraries on Linux can give sometime headache...!
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Lulu

  • Sr. Member
  • ****
  • Posts: 399
Re: Pac-Mac: a clone of the original game
« Reply #47 on: February 03, 2026, 09:55:51 pm »
Thanks again to Fred vS, Nimbus and Roland for their help !

You're welcome. Great! I will try the new version ASAP. (Until now I didn't manage to get sound.)
I'm curious to see the result  :)
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Fred vS

  • Hero Member
  • *****
  • Posts: 3778
    • StrumPract is the musicians best friend
Re: Pac-Mac: a clone of the original game
« Reply #48 on: February 03, 2026, 10:06:26 pm »
        libjack.so.0 => not found
   

Grrrr.

I haven't tried it, thanks for the tip.

If you're up for it, could you try modifying line 125 of u_audio.pas to this:

Code: Pascal  [Select][+][-]
  1.  res := uos_LoadLib(PChar('system'), PChar('system'), Nil, Nil, Nil, Nil, Nil);

Indeed, dependencies are my nightmare under Linux.
 
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3778
    • StrumPract is the musicians best friend
Re: Pac-Mac: a clone of the original game
« Reply #49 on: February 03, 2026, 10:15:34 pm »
If you're up for it, could you try modifying line 125 of u_audio.pas to this:

Code: Pascal  [Select][+][-]
  1.  res := uos_LoadLib(PChar('system'), PChar('system'), Nil, Nil, Nil, Nil, Nil);

Ooops, no the line is 261 not 125, sorry.

And for the library libportaudio.so in uos/lib ,I will compile portaudio with --without-jack parameter.

« Last Edit: February 03, 2026, 10:22:31 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3778
    • StrumPract is the musicians best friend
Re: Pac-Mac: a clone of the original game
« Reply #50 on: February 03, 2026, 10:41:28 pm »
I'm exaggerating, but if you have the patience, could you replace LibPortaudio-64.so, which is located in /PacMan/Binary/libuos/Linux/64bit, with the one attached as zip and keep:
Code: Pascal  [Select][+][-]
  1.  reslib := uos_LoadLib(PChar(PA_FileName), PChar(SF_FileName), nil, nil, nil, nil, nil);

If it works,I will give this one in uos lib.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Lulu

  • Sr. Member
  • ****
  • Posts: 399
Re: Pac-Mac: a clone of the original game
« Reply #51 on: February 03, 2026, 10:44:29 pm »
        libjack.so.0 => not found
   

Grrrr.

I haven't tried it, thanks for the tip.

If you're up for it, could you try modifying line 261 of u_audio.pas to this:

Code: Pascal  [Select][+][-]
  1.  res := uos_LoadLib(PChar('system'), PChar('system'), Nil, Nil, Nil, Nil, Nil);

Indeed, dependencies are my nightmare under Linux.

It doesn't work. My VM lubuntu machine is a fresh installation, I think there isn't libsndfile or port audio installed natively.
I don't want to install them with "sudo apt install ..." to continue to have errors if there is dependencies in a provided lib.


I've read your last post, ok I try it
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Fred vS

  • Hero Member
  • *****
  • Posts: 3778
    • StrumPract is the musicians best friend
Re: Pac-Mac: a clone of the original game
« Reply #52 on: February 03, 2026, 10:50:32 pm »
I don't want to install them with "sudo apt install ..." to continue to have errors if there is dependencies in a provided lib.

Yes,it is exactly what I want, something out-of-the-box that does not need extra install.
Many thanks for the test.

I will remove all the previous install of libsndfile-dev and openal-dev and try your last commit to see if all is ok with alsound now.

[EDIT] It is possible also that uos will need your libsndfile.so.
« Last Edit: February 03, 2026, 10:55:14 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Lulu

  • Sr. Member
  • ****
  • Posts: 399
Re: Pac-Mac: a clone of the original game
« Reply #53 on: February 03, 2026, 10:51:19 pm »
I'm exaggerating, but if you have the patience, could you replace LibPortaudio-64.so, which is located in /PacMan/Binary/libuos/Linux/64bit, with the one attached as zip and keep:
Code: Pascal  [Select][+][-]
  1.  reslib := uos_LoadLib(PChar(PA_FileName), PChar(SF_FileName), nil, nil, nil, nil, nil);

If it works,I will give this one in uos lib.
Yes, it work now, sounds play correctly.
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Lulu

  • Sr. Member
  • ****
  • Posts: 399
Re: Pac-Mac: a clone of the original game
« Reply #54 on: February 03, 2026, 10:53:43 pm »
I checked the dependencies:
does libasound is ALSA ?

Another question: PortAudio need another library to deal with the hardware ?
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Fred vS

  • Hero Member
  • *****
  • Posts: 3778
    • StrumPract is the musicians best friend
Re: Pac-Mac: a clone of the original game
« Reply #55 on: February 03, 2026, 10:57:44 pm »
does libasound is ALSA ?

Yes, but usually it is installed by default on Linux.

Another question: PortAudio need another library to deal with the hardware ?

No, only those dependencies.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3778
    • StrumPract is the musicians best friend
Re: Pac-Mac: a clone of the original game
« Reply #56 on: February 03, 2026, 11:31:40 pm »
OK I did
Code: Pascal  [Select][+][-]
  1. sudo apt-get remove libsndfile1-dev
Code: Pascal  [Select][+][-]
  1. sudo apt-get remove libopenal

And using your previous code without last patch that was working with sound, alsound and libsndfile fail to load.

I tried then with your last commit and ... bingo, it works de-puta-madre (out-of-the-box).  ;D

Well done Lulu, your Pac-Man + OGLCScene + ALSound is perfect now.

Last detail, if you want to make Pac-Man ready for BSD OS (FreeBSD, OpenBSD, NetBSD, DragonFlyBSD) you may change in FormCreate():
Change this:
Code: Pascal  [Select][+][-]
  1. {$if defined(Linux)}
with that:
Code: Pascal  [Select][+][-]
  1. {$if defined(Unix) and not defined(Darwin)}
« Last Edit: February 04, 2026, 02:10:12 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Lulu

  • Sr. Member
  • ****
  • Posts: 399
Re: Pac-Mac: a clone of the original game
« Reply #57 on: February 04, 2026, 09:31:48 am »
@Fred:
I'm happy  that all work now !
As the saying goes: "Tout vient à point à qui sait attendre"  :D
(possible translation: "Everything comes to those who wait.")

I've made the changes for the BSD OS. The procedure is now:
Code: Pascal  [Select][+][-]
  1. procedure TFormMain.FormCreate(Sender: TObject);
  2. {$ifdef Linux}var BoundsRect_client: TRect;{$endif}
  3. begin
  4. {$ifdef MAXIMIZE_SCENE_ON_MONITOR}
  5.   FScene := TOGLCScene.Create(OpenGLControl1, SCREEN_WIDTH_AT_DESIGN_TIME/SCREEN_HEIGHT_AT_DESIGN_TIME);
  6.  {$ifdef WINDOWED_MODE}
  7.    // WINDOWED MODE
  8.    {$if defined(Darwin)}
  9.      BorderIcons := [biSystemMenu,biMinimize];
  10.      BoundsRect := Monitor.BoundsRect;
  11.    {$elseif defined(Unix)}
  12.      BoundsRect_client := Monitor.BoundsRect;
  13.      BoundsRect_client.Width := Monitor.BoundsRect.width - 100;
  14.      BoundsRect_client.left:= 50;
  15.      BoundsRect_client.height := Monitor.BoundsRect.height - 100;
  16.      BoundsRect_client.top:= 50;
  17.      BoundsRect := BoundsRect_client;
  18.      WindowState := wsNormal;
  19.    {$elseif defined(Windows)}
  20.      WindowState := wsMaximized;
  21.      BorderIcons := [biSystemMenu, biMinimize, biMaximize]; // necessary to see the task bar
  22.    {$endif}
  23.  
  24.  {$else}
  25.    // FULLSCREEN MODE
  26.    {$if defined(Darwin)}
  27.      BoundsRect := Monitor.BoundsRect;
  28.    {$elseif defined(Windows) or defined(Unix)}
  29.      BorderIcons := [];
  30.      BorderStyle := bsNone;
  31.      WindowState := wsFullScreen;
  32.      ShowWindow(Handle, SW_SHOWFULLSCREEN);
  33.      BoundsRect := Monitor.BoundsRect;
  34.    {$endif}
  35.  {$endif}
  36. {$else}
  37.      // WINDOWED MODE WITH FIXED SIZE
  38.      ClientWidth := Trunc(SCREEN_WIDTH_AT_DESIGN_TIME);
  39.      ClientHeight := Trunc(SCREEN_HEIGHT_AT_DESIGN_TIME);
  40.      FScene := TOGLCScene.Create(OpenGLControl1, -1);
  41.      BorderIcons := [biSystemMenu];
  42.      BorderStyle := bsSingle;
  43.      WindowState := wsNormal;
  44. {$endif}
  45. ...

Thank you very much Fred for your precious help!
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

Fred vS

  • Hero Member
  • *****
  • Posts: 3778
    • StrumPract is the musicians best friend
Re: Pac-Mac: a clone of the original game
« Reply #58 on: February 04, 2026, 12:57:30 pm »
As the saying goes: "Tout vient à point à qui sait attendre"  :D

Salut Lulu.

"Patience et longueur de temps font plus que force ni que rage" dixit JdlF.

By the way, one little detail (you know, I am insupportable).
If you want Pac-Man totally ready for BSD, you may change this:

Code: Pascal  [Select][+][-]
  1. procedure TFormMain.FormCreate(Sender: TObject);
  2. {$ifdef Linux}var BoundsRect_client: TRect;{$endif}

with that:

Code: Pascal  [Select][+][-]
  1. procedure TFormMain.FormCreate(Sender: TObject);
  2. {$if defined(Unix) and not defined(Darwin)}var BoundsRect_client: TRect;{$endif}
« Last Edit: February 04, 2026, 01:12:57 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Lulu

  • Sr. Member
  • ****
  • Posts: 399
Re: Pac-Mac: a clone of the original game
« Reply #59 on: February 04, 2026, 01:13:11 pm »
Oh yes, I forgot this one! Thanks !
Changed and updated.

I've added a link to your UOS version at the beginning of this thread.
wishing you a nice life!
GitHub repositories https://github.com/Lulu04

 

TinyPortal © 2005-2018