OpenArena / engine

OpenArena modifications to the ioquake3 engine
http://openarena.ws
GNU General Public License v2.0
211 stars 50 forks source link

Support for 64 bit Mac OS Catalina #61

Open lisacmer opened 4 years ago

lisacmer commented 4 years ago

Unfortunately current build doesn't work with newest Mac OS Catalina, since they dropped support for 32 bit applications. I tried to compile using included make-macosx.sh script after installing libogg libvorbis sdl12 from brew. Using resources from original build 0.8.8 the app starts fine. Menu works fine. Unfortunately as soon as there are 3d graphics involved (for example Player settings in menu, or starting or connecting to any game) the app crashes with the following log

stitched 20 LoD cracks
...loaded 4106 faces, 90 meshes, 0 trisurfs, 0 flares
----- Client Shutdown (Received signal 6) -----
----- FS_Startup -----
Current search path:
/Users/user/Library/Application Support/OpenArena/baseoa
./baseoa
./baseoa/tr1ckhouse-beta3.pk3 (27 files)
./baseoa/pak6-patch088.pk3 (711 files)
./baseoa/pak6-patch085.pk3 (559 files)
./baseoa/pak6-misc.pk3 (229 files)
./baseoa/pak5-TA.pk3 (139 files)
./baseoa/pak4-textures.pk3 (1753 files)
./baseoa/pak2-players.pk3 (669 files)
./baseoa/pak2-players-mature.pk3 (231 files)
./baseoa/pak1-maps.pk3 (100 files)
./baseoa/pak0.pk3 (1042 files)

----------------------
5460 files in pk3 files
forcefully unloading cgame vm
RE_Shutdown( 1 )
OpenAL capture device closed.
-----------------------
----- Server Shutdown (Received signal 6) -----
==== ShutdownGame ====
AAS shutdown.
---------------------

Is there any direction i should follow to find the problem or maybe there will be an official build with Mac OS Catalina support?

leilei- commented 4 years ago

The past OSX builds were contributed by jackoverfull. I don't have a modern mac, so I can't really do anything about mac support from my end besides my hopes of not regressing the mac targets.

The-Gig commented 4 years ago

Jackoverfull said he doesn't have a modern Mac, and he mostly doesn't code since a few years. He suggests one may try to manage to compile 64bit mac ioq3 first and then re-apply all oa customizations one at once, to find out where the problem is... a long work.

Also related: https://github.com/OpenArena/legacy/issues/1

In the meanwhile, possible workarounds (for users) mentioned have been using a Windows or Linux virtual machine, a Linux bootable usb stick, a software like CrossOver (which is paid software) for running 32bit mac apps, or maybe the free "PlayOnMac" software (https://www.playonmac.com/) to try running Windows 32bit binaries on Mac (untested).

cubuspl42 commented 2 years ago

The steps I took to build OpenArena (including crafting an .app bundle) on a modern macOS systems are described in this PR.

I confirm that, when launched, the main menu worked, but the game crashed when you tried to actually play (for example, in single player mode). The log said it was something with SIGILL signal.

I built the game in debug mode (see this commit on the debug branch of my fork). I debugged it with LLDB and found out that it's crashing in... a string copying function.

It seems that the game is calling (in some cases) the strncpy function in a way that triggers undefined behavior. As the calls can come through the in-game virtual machine, it was unrealistic to find the root causes of all offending calls, so I just provided a custom implementation of strncpy that does little to no assumptions about the passed arguments.

The work-around is in this PR.

The patched app bundle release is available here. It's hand-crafted, as I wasn't able to generate app bundle through provided scripts (see this issue).

cubuspl42 commented 2 years ago

I've learnt that the app bundle I linked doesn't contain 64-bit SDL and libxmp libraries. So it "works for me" and for anyone who manually installs SDL / libxmp through Homebrew.

NeonKnightOA commented 2 years ago

Tagging @sago007 , though he mentioned that he doesn't have Macs. So yeah, we're quite in dire need of help in that block.

rotolonico commented 2 years ago

I tried @cubuspl42 's PR on my Intel-I5 Macbook Pro (after installing SDL and libxmp) and it does work but every time I change any graphical setting the app crashes and on the next run it prompts me to open it with 'safe' video settings. This is a problem because safe settings have fullscreen disabled and have a resolution of 640x480.

Logs right after changing the settings (and the crash):

PIXELFORMAT: color(24-bits) Z(24-bit) stencil(8-bits)
MODE: 3, 640 x 480 windowed hz:N/A
GAMMA: hardware w/ 0 overbright bits
rendering primitives: multiple glArrayElement
texturemode: GL_LINEAR_MIPMAP_NEAREST
picmip: 1
texture bits: 0
multitexture: enabled
compiled vertex arrays: disabled
texenv add: enabled
compressed textures: disabled
glsl programs: disabled
----- finished R_Init -----
------ Initializing Sound ------
Trying to load "/System/Library/Frameworks/OpenAL.framework/OpenAL"...
Allocated 64 sources.
OpenAL default capture device is 'MacBook Pro Microphone'
OpenAL capture device opened.
OpenAL info:
  Vendor:         Apple Computer Inc.
  Version:        1.1
  Renderer:       Software
  AL Extensions:  AL_EXT_OFFSET AL_EXT_LINEAR_DISTANCE AL_EXT_EXPONENT_DISTANCE AL_EXT_float32 AL_EXT_STATIC_BUFFER AL_EXT_SOURCE_NOTIFICATIONS AL_EXT_SOURCE_SPATIALIZATION
  ALC Extensions: ALC_EXT_CAPTURE ALC_ENUMERATION_EXT ALC_EXT_MAC_OSX ALC_EXT_ASA ALC_EXT_ASA_DISTORTION ALC_EXT_ASA_ROGER_BEEP
  Device:         External Headphones
  Available Devices:
External Headphones
  Input Device:   MacBook Pro Microphone
  Available Input Devices:
MacBook Pro Microphone
Sound initialization successful.
--------------------------------
Loading vm file vm/ui.qvm...
File "vm/ui.qvm" found in "/Users/nicorotolo/Downloads/openarena/OpenArena.app/Contents/MacOS/baseoa/pak6-patch088.pk3"
...which has vmMagic VM_MAGIC_VER2
Loading 1555 jump table targets
VM file ui compiled to 785004 bytes of code
ui loaded in 1848448 bytes on the hunk
58 arenas parsed
33 bots parsed
--- Common Initialization Complete ---
Hostname: Domenicos-MBP.fritz.box
IP: 192.168.178.58
Opening IP6 socket: [::]:27960
Opening IP socket: 0.0.0.0:27960
previous mouse acceleration: 0.875000
restoring mouse acceleration to: 0.875000
previous mouse acceleration: 0.875000
Requesting servers from master dpmaster.deathmask.net...
CL_ServersResponsePacket
115 servers parsed (total 115)
Hunk_Clear: reset the hunk ok
RE_Shutdown( 1 )
restoring mouse acceleration to: 0.875000
----- Initializing Renderer ----
-------------------------------
----- R_Init -----
Cmd_AddCommand: paletteglsldump already defined
SDL using driver "Quartz"
Initializing OpenGL display
...setting mode 3: 640 480
tty]Unable to obtain graphics context for NSWindow (Mojave behavior)
Using 8/8/8 Color bits, 24 depth, 0 stencil display.
Available modes: '1024x576 1280x720 1344x756 1600x900 1920x1080 720x480 640x480 800x600 1024x768 1280x960 1344x1008 720x576'
GL_RENDERER: Intel(R) Iris(TM) Plus Graphics OpenGL Engine
----- Client Shutdown (Received signal 11) -----
RE_Shutdown( 1 )
Hunk_Clear: reset the hunk ok
OpenAL capture device closed.
-----------------------
tomnic79 commented 1 year ago

I can actually run OpenArena in Monterey but I have a very strange random hang during gameplay, expecially at very high resolution such as 2k or 4k, but it also occurs in Full HD... the screen freezes, the audio stutters for 5-6 seconds, then everything is back to normal since another hang occurs... and so on... I think this is related the way the fix for 64 bit executable is done... how can I help debugging?

jmarino83 commented 6 months ago

hi everyone im able to run the game on a 64 bit osx but i cant save settings, or download the content from servers. Pls anyone can help me i really want to play this game.

Best Regards

NeonKnightOA commented 6 months ago

Has anyone created a pull-request for this?

cubuspl42 commented 6 months ago

@NeonKnightOA

I have: https://github.com/OpenArena/engine/pull/70, but it wasn't accepted and needs refactoring to be accepted I guess. You can pick that PR and start working on a new iteration.

NeonKnightOA commented 6 months ago

I'm... not confident enough to tackle the engine side of things. And I'm quite busy already with the gamecode repo too. Not to mention the lack of a Mac.

But I can take a look. Leilei and Sago are the ones who have the final say.

cubuspl42 commented 6 months ago

I understand, as I also closed the linked PR because of a lack of time.