assaultcube / AC

AssaultCube
841 stars 213 forks source link

[release_1.3_beta3] : powerpc port : censored own IP: 0.0.0.0 / startgame() abused () #416

Open kas1e opened 2 years ago

kas1e commented 2 years ago

H all!

I tried to port the latest 1.3 sources from GitHub to amigaos4 (powerpc32 based hardware, so big-endian), and while all compiles fine, on running i have that:

init: localconnect
own IP: 0.0.0.0, censored own IP: 0.0.0.0, --, clock offset -455113 hours -51 minutes
auth challenge: SERVINFOCHALLENGE<(0) cn: 0 c: 0.0.0.0 (--) s: 0.0.0.0:0 3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29 st: 0 ct: 27306831 (-942993119)>
init: mainloop
Acessfully pinged 0 media servers, 1 failure, 0 disabled
startgame() abused () 

Can anyone point me out what can be wrong there ? Previous versions if i remember right does not have this issue. Maybe there were some new non-endian-aware network code written?

Thans!

ac-stef commented 2 years ago

Did it actually say "Acessfully"?

kas1e commented 2 years ago

Yeah, exactly "Acessfully"

ac-stef commented 2 years ago

"startgame() abused" should not happen. Is your start script okay, do you provide all media files, start from the proper directory? Why does pinging the media server fail?

Did you have to make changes to the code to compile? Do you get warnings? Can you check to compile in debug mode?

kas1e commented 2 years ago

There are full steps i do:

Clone this version:

git clone https://github.com/assaultcube/AC/ --branch release_1.3

Come to AC/source/src

And there i tweaked makefile so to make it works on my cross-platform dev-env:

  1. replaced clang on powerpc-amigaos-gcc
  2. changed to build enet as static libs on cross compiler ad well as everything build statically , so also removed -rdynamic then
  3. replaced sdl-config directly on a path where i had my SDL2 includes.
  4. Fixed linker libs and compiler options so to make it links on my side.

There makefile i currently have:

# Ideally, you can override these parameters directly via the commandline, or by
# creating a seperate 'Makefile_local' file (this way, your changes aren't
# accidentally commited to the AssaultCube repository).

# AssaultCube now uses clang++ as a compiler, as there have been random crashes
# found to have been caused by the g++ compiler in the past. This seems to have
# been fixed now by relaxing the optimization that g++ does, so although we'll
# continue using clang++ (just in case), you can use g++ if you prefer.

CXX=ppc-amigaos-gcc

# Changing this to ACDEBUG=yes will compile a debug version of AssaultCube.
ACDEBUG=no

PLATFORM=AMIGAOS4

# This prefix is only used to name the installed executables.
PLATFORM_PREFIX=native

# As above, this file is optional only.
-include Makefile_local

ifeq ($(ACDEBUG),yes)
    CXXFLAGS= -O0
    override CXXFLAGS+= -gstabs -D_DEBUG
endif

ifneq (,$(findstring clang,$(CXX)))
    CXXFLAGS= -O3 -fomit-frame-pointer
    override CXXFLAGS+= -Wall -fsigned-char
else
ifneq (,$(findstring AMIGAOS4,$(PLATFORM)))
    CXXFLAGS= -O3 -fomit-frame-pointer
    override CXXFLAGS+= -athread=native -Wall -fsigned-char -ffast-math -Wno-format-zero-length
    ifeq "$(shell expr 'ppc-amigaos-gcc -dumpversion' \>= 8)" "1"
        override CXXFLAGS+= -Wno-stringop-truncation
    endif   
else
    CXXFLAGS= -O3 -fomit-frame-pointer
    override CXXFLAGS+= -Wall -fsigned-char -ffast-math -rdynamic -Wno-format-zero-length
    ifeq "$(shell expr 'gcc -dumpversion' \>= 8)" "1"
        override CXXFLAGS+= -Wno-stringop-truncation
    endif
endif
endif
INCLUDES= -I. -Ibot -I../enet/include

STRIP=
ifeq (,$(findstring -g,$(CXXFLAGS)))
ifeq (,$(findstring -pg,$(CXXFLAGS)))
  STRIP=strip
endif
endif

MV=mv
ifneq (,$(findstring MINGW,$(PLATFORM)))
WINDRES= windres
CLIENT_INCLUDES= $(INCLUDES) -I../include
CLIENT_LIBS= -mwindows -L../lib -lSDL2 -lSDL2_image -lzdll -lopengl32 -lenet -lOpenAL32 -llibvorbisfile -lws2_32 -lwinmm
else
ifneq (,$(findstring AMIGAOS4,$(PLATFORM)))
CLIENT_INCLUDES= $(INCLUDES) -I/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/include/SDL2 -idirafter ../include
CLIENT_LIBS= -L../enet/.libs -lenet -static -lSDL2_gl4es -lgl4es -lSDL2_image -ljpeg -ltiff -lwebp -lpng16 -lopenal -lvorbisfile -lvorbis -logg -lpthread -lstdc++ -lz
else
USRLIB=$(shell if [ -e /usr/lib64 ]; then echo "/usr/lib64"; else echo "/usr/lib"; fi)
CLIENT_INCLUDES= $(INCLUDES) -I/usr/include `sdl2-config --cflags` -idirafter ../include
CLIENT_LIBS= -L../enet/.libs -lenet -L$(USRLIB) -lX11 `sdl2-config --libs` -lSDL2_image -lz -lGL -lopenal -lvorbisfile
endif
endif

CLIENT_OBJS= \
    crypto.o \
    audiomanager.o \
    autodownload.o \
    client.o \
    clientgame.o \
    clients2c.o \
    command.o \
    console.o \
    docs.o \
    editing.o \
    entities.o \
    http.o \
    log.o \
    main.o \
    menus.o \
    oggstream.o \
    openal.o \
    packetqueue.o \
    physics.o \
    protocol.o \
    rendercubes.o \
    rendergl.o \
    renderhud.o \
    rendermodel.o \
    renderparticles.o \
    rendertext.o \
    rndmap.o \
    scoreboard.o \
    serverms.o \
    server.o \
    serverbrowser.o \
    shadow.o \
    soundlocation.o \
    soundscheduler.o \
    stream.o \
    texture.o \
    tools.o \
    water.o \
    weapon.o \
    wizard.o \
    world.o \
    worldio.o \
    worldlight.o \
    worldocull.o \
    worldrender.o \
    zip.o \
    bot/bot.o \
    bot/botmanager.o \
    bot/bot_ai.o \
    bot/bot_util.o \
    bot/bot_waypoint.o \
    bot/ac_bot.o \
    bot/ac_bot_ai.o

CLIENT_PCH= cube.h.gch

ifneq (,$(findstring MINGW,$(PLATFORM)))
SERVER_INCLUDES= -DSTANDALONE $(INCLUDES) -I../include
SERVER_LIBS= -L../lib -lzdll -lenet -lws2_32 -lwinmm
else
SERVER_INCLUDES= -DSTANDALONE $(INCLUDES)
SERVER_LIBS= -L../enet/.libs -lenet -lz -lpthread
ifeq (,$(findstring OpenBSD,$(PLATFORM)))
SERVER_LIBS+= -lrt
endif
endif

SERVER_OBJS= \
    crypto-standalone.o \
    log-standalone.o \
    protocol-standalone.o \
    serverms-standalone.o \
    server-standalone.o \
    stream-standalone.o \
    tools-standalone.o \
    wizard-standalone.o
MASTER_OBJS= \
    stream-standalone.o \
    command-standalone.o \
    master-standalone.o

ifeq ($(PLATFORM),SunOS)
CLIENT_LIBS+= -lsocket -lnsl -lX11
SERVER_LIBS+= -lsocket -lnsl
endif

default: all

all: client server

../enet/Makefile:
ifneq (,$(findstring AMIGAOS4,$(PLATFORM)))
    cd ../enet; ./configure --build=x86_64 --host=ppc-amigaos --target=ppc-amigaos --enable-shared=no --enable-static=yes 
else
    cd ../enet; ./configure --enable-shared=no --enable-static=yes
endif

libenet: ../enet/Makefile
    -$(MAKE) -C ../enet all

clean-enet: ../enet/Makefile
    $(MAKE) -C ../enet/ clean

clean:
    -$(RM) $(CLIENT_PCH) $(CLIENT_OBJS) $(SERVER_OBJS) $(MASTER_OBJS) ac_client ac_server ac_master

mrproper: clean ../enet/Makefile
    $(MAKE) -C ../enet/ distclean
    -$(RM) ../enet/Makefile

%.h.gch: %.h
    $(CXX) $(CXXFLAGS) -x c++-header -o $@.tmp $(subst .h.gch,.h,$@)
    $(MV) $@.tmp $@

rendermodel.o: rendermodel.cpp
    $(CXX) $(CXXFLAGS) -fno-strict-aliasing -c -o $@ $(subst .o,.cpp,$@)

%-standalone.o: %.cpp
    $(CXX) $(CXXFLAGS) -c -o $@ $(subst -standalone.o,.cpp,$@)

$(CLIENT_OBJS): CXXFLAGS += $(CLIENT_INCLUDES)
$(CLIENT_OBJS): $(CLIENT_PCH)
$(SERVER_OBJS): CXXFLAGS += $(SERVER_INCLUDES)
$(filter-out $(SERVER_OBJS),$(MASTER_OBJS)): CXXFLAGS += $(SERVER_INCLUDES)

ifneq (,$(findstring MINGW,$(PLATFORM)))
client: $(CLIENT_OBJS)
    $(WINDRES) -I ../vcpp -i ../vcpp/assaultcube.rc -J rc -o ../vcpp/assaultcube.res -O coff
    $(CXX) $(CXXFLAGS) -o ../../bin_win32/ac_client.exe ../vcpp/assaultcube.res $(CLIENT_OBJS) $(CLIENT_LIBS)

server: $(SERVER_OBJS)
    $(CXX) $(CXXFLAGS) -o ../../bin_win32/ac_server.exe $(SERVER_OBJS) $(SERVER_LIBS)

master: $(MASTER_OBJS)
    $(CXX) $(CXXFLAGS) -o ../../bin_win32/ac_master.exe $(MASTER_OBJS) $(SERVER_LIBS)

client_install: client
server_install: server

else
client: libenet $(CLIENT_OBJS)
    $(CXX) $(CXXFLAGS) -o ac_client $(CLIENT_OBJS) $(CLIENT_LIBS)

server: libenet $(SERVER_OBJS)
    $(CXX) $(CXXFLAGS) -o ac_server $(SERVER_OBJS) $(SERVER_LIBS)
master: libenet $(MASTER_OBJS)
    $(CXX) $(CXXFLAGS) -o ac_master $(MASTER_OBJS) $(SERVER_LIBS)

client_install: client
    install -d ../../bin_unix/
    install -m755 ac_client ../../bin_unix/$(PLATFORM_PREFIX)_client
#ifneq (,$(STRIP))
#   $(STRIP) ../../bin_unix/$(PLATFORM_PREFIX)_client
#endif

server_install: server
    install -d ../../bin_unix/
    install -m755 ac_server ../../bin_unix/$(PLATFORM_PREFIX)_server
#ifneq (,$(STRIP))
#   $(STRIP) ../../bin_unix/$(PLATFORM_PREFIX)_server
#endif

endif

install: client_install server_install

depend:
    makedepend -Y -I. -Ibot $(subst .o,.cpp,$(CLIENT_OBJS))
    makedepend -a -o.h.gch -Y -I. -Ibot $(subst .h.gch,.h,$(CLIENT_PCH))
    makedepend -a -o-standalone.o -Y -I. -Ibot $(subst -standalone.o,.cpp,$(SERVER_OBJS))
    makedepend -a -o-standalone.o -Y -I. $(subst -standalone.o,.cpp,$(filter-out $(SERVER_OBJS), $(MASTER_OBJS)))

# DO NOT DELETE

crypto.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
crypto.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
crypto.o: protos.h crypto_tools.h ge25519_base.data
audiomanager.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
audiomanager.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
audiomanager.o: protos.h
autodownload.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
autodownload.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
autodownload.o: protos.h
client.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
client.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
client.o: protos.h bot/bot.h bot/bot_util.h bot/bot_waypoint.h bot/ac_bot.h
clientgame.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
clientgame.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
clientgame.o: protos.h bot/bot.h bot/bot_util.h bot/bot_waypoint.h
clientgame.o: bot/ac_bot.h
clients2c.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
clients2c.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
clients2c.o: protos.h bot/bot.h bot/bot_util.h bot/bot_waypoint.h
clients2c.o: bot/ac_bot.h
command.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
command.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
command.o: protos.h
console.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
console.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
console.o: protos.h
docs.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h weapon.h
docs.o: entity.h world.h command.h varray.h vote.h console.h protos.h
editing.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
editing.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
editing.o: protos.h
entities.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
entities.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
entities.o: protos.h
http.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h weapon.h
http.o: entity.h world.h command.h varray.h vote.h console.h protos.h
log.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h weapon.h
log.o: entity.h world.h command.h varray.h vote.h console.h protos.h
main.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h weapon.h
main.o: entity.h world.h command.h varray.h vote.h console.h protos.h
main.o: jpegenc.h
menus.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h weapon.h
menus.o: entity.h world.h command.h varray.h vote.h console.h protos.h
oggstream.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
oggstream.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
oggstream.o: protos.h
openal.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
openal.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
openal.o: protos.h
packetqueue.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
packetqueue.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
packetqueue.o: protos.h
physics.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
physics.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
physics.o: protos.h
protocol.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
protocol.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
protocol.o: protos.h
rendercubes.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
rendercubes.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
rendercubes.o: protos.h
rendergl.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
rendergl.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
rendergl.o: protos.h bot/bot.h bot/bot_util.h bot/bot_waypoint.h bot/ac_bot.h
renderhud.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
renderhud.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
renderhud.o: protos.h
rendermodel.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
rendermodel.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
rendermodel.o: protos.h tristrip.h modelcache.h vertmodel.h md2.h md3.h
renderparticles.o: cube.h platform.h tools.h geom.h model.h protocol.h
renderparticles.o: sound.h weapon.h entity.h world.h command.h varray.h
renderparticles.o: vote.h console.h protos.h
rendertext.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
rendertext.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
rendertext.o: protos.h
rndmap.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
rndmap.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
rndmap.o: protos.h
scoreboard.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
scoreboard.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
scoreboard.o: protos.h
serverms.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
serverms.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
serverms.o: protos.h
server.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
server.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
server.o: protos.h server.h servercontroller.h serverfiles.h serverchecks.h
server.o: serverevents.h serveractions.h
serverbrowser.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
serverbrowser.o: weapon.h entity.h world.h command.h varray.h vote.h
serverbrowser.o: console.h protos.h
shadow.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
shadow.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
shadow.o: protos.h
soundlocation.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
soundlocation.o: weapon.h entity.h world.h command.h varray.h vote.h
soundlocation.o: console.h protos.h
soundscheduler.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
soundscheduler.o: weapon.h entity.h world.h command.h varray.h vote.h
soundscheduler.o: console.h protos.h
stream.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
stream.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
stream.o: protos.h
texture.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
texture.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
texture.o: protos.h scale.h
tools.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h weapon.h
tools.o: entity.h world.h command.h varray.h vote.h console.h protos.h
water.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h weapon.h
water.o: entity.h world.h command.h varray.h vote.h console.h protos.h
weapon.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
weapon.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
weapon.o: protos.h bot/bot.h bot/bot_util.h bot/bot_waypoint.h bot/ac_bot.h
weapon.o: hudgun.h
wizard.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
wizard.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
wizard.o: protos.h
world.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h weapon.h
world.o: entity.h world.h command.h varray.h vote.h console.h protos.h
world.o: bot/bot.h bot/bot_util.h bot/bot_waypoint.h bot/ac_bot.h
worldio.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
worldio.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
worldio.o: protos.h
worldlight.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
worldlight.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
worldlight.o: protos.h
worldocull.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
worldocull.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
worldocull.o: protos.h
worldrender.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
worldrender.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
worldrender.o: protos.h
zip.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h weapon.h
zip.o: entity.h world.h command.h varray.h vote.h console.h protos.h
bot/bot.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
bot/bot.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
bot/bot.o: protos.h bot/bot.h bot/bot_util.h bot/bot_waypoint.h bot/ac_bot.h
bot/botmanager.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
bot/botmanager.o: weapon.h entity.h world.h command.h varray.h vote.h
bot/botmanager.o: console.h protos.h bot/bot.h bot/bot_util.h
bot/botmanager.o: bot/bot_waypoint.h bot/ac_bot.h
bot/bot_ai.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
bot/bot_ai.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
bot/bot_ai.o: protos.h bot/bot.h bot/bot_util.h bot/bot_waypoint.h
bot/bot_ai.o: bot/ac_bot.h
bot/bot_util.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
bot/bot_util.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
bot/bot_util.o: protos.h bot/bot.h bot/bot_util.h bot/bot_waypoint.h
bot/bot_util.o: bot/ac_bot.h
bot/bot_waypoint.o: cube.h platform.h tools.h geom.h model.h protocol.h
bot/bot_waypoint.o: sound.h weapon.h entity.h world.h command.h varray.h
bot/bot_waypoint.o: vote.h console.h protos.h bot/bot.h bot/bot_util.h
bot/bot_waypoint.o: bot/bot_waypoint.h bot/ac_bot.h
bot/ac_bot.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
bot/ac_bot.o: weapon.h entity.h world.h command.h varray.h vote.h console.h
bot/ac_bot.o: protos.h bot/bot.h bot/bot_util.h bot/bot_waypoint.h
bot/ac_bot.o: bot/ac_bot.h
bot/ac_bot_ai.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
bot/ac_bot_ai.o: weapon.h entity.h world.h command.h varray.h vote.h
bot/ac_bot_ai.o: console.h protos.h bot/bot.h bot/bot_util.h
bot/ac_bot_ai.o: bot/bot_waypoint.h bot/ac_bot.h

cube.h.gch: platform.h tools.h geom.h model.h protocol.h sound.h weapon.h
cube.h.gch: entity.h world.h command.h varray.h vote.h console.h protos.h

crypto-standalone.o: cube.h platform.h tools.h geom.h model.h protocol.h
crypto-standalone.o: sound.h weapon.h entity.h world.h command.h varray.h
crypto-standalone.o: vote.h console.h protos.h crypto_tools.h
crypto-standalone.o: ge25519_base.data
log-standalone.o: cube.h platform.h tools.h geom.h model.h protocol.h sound.h
log-standalone.o: weapon.h entity.h world.h command.h varray.h vote.h
log-standalone.o: console.h protos.h
protocol-standalone.o: cube.h platform.h tools.h geom.h model.h protocol.h
protocol-standalone.o: sound.h weapon.h entity.h world.h command.h varray.h
protocol-standalone.o: vote.h console.h protos.h
serverms-standalone.o: cube.h platform.h tools.h geom.h model.h protocol.h
serverms-standalone.o: sound.h weapon.h entity.h world.h command.h varray.h
serverms-standalone.o: vote.h console.h protos.h
server-standalone.o: cube.h platform.h tools.h geom.h model.h protocol.h
server-standalone.o: sound.h weapon.h entity.h world.h command.h varray.h
server-standalone.o: vote.h console.h protos.h server.h servercontroller.h
server-standalone.o: serverfiles.h serverchecks.h serverevents.h
server-standalone.o: serveractions.h
stream-standalone.o: cube.h platform.h tools.h geom.h model.h protocol.h
stream-standalone.o: sound.h weapon.h entity.h world.h command.h varray.h
stream-standalone.o: vote.h console.h protos.h
tools-standalone.o: cube.h platform.h tools.h geom.h model.h protocol.h
tools-standalone.o: sound.h weapon.h entity.h world.h command.h varray.h
tools-standalone.o: vote.h console.h protos.h
wizard-standalone.o: cube.h platform.h tools.h geom.h model.h protocol.h
wizard-standalone.o: sound.h weapon.h entity.h world.h command.h varray.h
wizard-standalone.o: vote.h console.h protos.h

command-standalone.o: cube.h platform.h tools.h geom.h model.h protocol.h
command-standalone.o: sound.h weapon.h entity.h world.h command.h varray.h
command-standalone.o: vote.h console.h protos.h
master-standalone.o: cube.h platform.h tools.h geom.h model.h protocol.h
master-standalone.o: sound.h weapon.h entity.h world.h command.h varray.h
master-standalone.o: vote.h console.h protos.h

After that run make client.

  1. first change:

It brings me errors about log.cpp:12:39: error: ‘LOG_LOCAL0’ was not declared in this scope and so on, so i fixed that by going to log.cpp , and expanded line 5, like this:

#if !defined(WIN32) && !defined(__APPLE__) && !defined(__amigaos4__).

  1. second change:

stream.cpp:288:12: error: ‘readdir_r’ was not declared in this scope

This one i curious about as i didn't have readdir_r function at all in my SDK, so for time being (and do not know if that one can be guilty of issues i had), i return null it. Like this:

#if !defined(WIN32)
int readdir_r_(DIR *d, struct dirent *b, struct dirent **de)
{
    #ifdef __USE_POSIX
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
    #endif
    #ifdef __amigaos4__
    return NULL;
    #else
    return readdir_r(d, b, de);
    #endif
    #ifdef __USE_POSIX
    #pragma GCC diagnostic pop
    #endif
}
#endif

And that all.

Next, i copy to the working machine those dirs from the cloned repo:

bot config demos mods packages profile

and in the same place "ac_client" binary.

Running it, and then have that error i post before.

And, btw, the first two symbols of the word "Successfully" are always trashed. So it was "Acesfully", and now it's just "$]cesfully", meaning some memory trashing happens seems so.

As for Debug build, i change in Makefile ACDEBUG=yes , trying to compile, and can't, because of this code in tools.h being x86/x64 only:

#ifdef _DEBUG
#ifdef __GNUC__
#define ASSERT(c) if(!(c)) { fflush(NULL); asm("int $3"); }
#else
#define ASSERT(c) if(!(c)) { fflush(NULL); { __asm int 3 } }
#endif

So i have just undefs to "int" instruction which powerpc cpus didn't have. Will it be safe to just comment them out on my side for debugging purposes or it needs some equivalent?

ac-stef commented 2 years ago

Yep, that readdir_r is killing you. Just returning NULL makes all directories look empty, therefore no maps are found and startgame() complains about being called with an empty map name.

Do you have readdir() instead?

ac-stef commented 2 years ago

As for the debug compile: I'm pretty sure, C-Compilers on powerpc support some sort of assertion. Use that or just leave it commented out.

kas1e commented 2 years ago

Do you have readdir() instead?

Yeah, readdir() are here. But not sure that i had the skills to rewrite it properly. i only found in google that since some time readdr_r were deprecated in some SDKs as it have issues

ac-stef commented 2 years ago

replace return readdir_r(d, b, de);

with *de = readdir(d); return de == NULL ? 1 : 0;

This /should/ work, if you have no readdir_r(). At first, readdir() was not thread-safe, therefore the thread-safe readdir_r() was created. Now on many systems readdir_r() is deprecated, "because readdir() was updated to be thread-safe itself". The problem is, you can't really tell, if readdir() is thread-safe or not - but readdir_r() always is, which is why I used it...

If your implementation of readdir() is not thread-safe, on very rare occasions, the game may read a directory entry wrong.

kas1e commented 2 years ago

Not sure if it did the trick or not, but now it crashes on ac:client:png_malloc(). Are there png12 or png16 used? Maybe that issue... Or is it is still an issue with reading files...

I running some dos-tracing tool and can see that I have lots of FAILS on lock/open of files from packages/audio/weapon/carbine_reload (without .ogg at end ..) . Lots of Open/Fail from profile/packages/, profile/config, etc. And profle dr have just a few log flies and 2 dirs : config and packages, which is mostly empty and didn't have the links i found to be Fail in dos-trace tool. But maybe that expected ..

ac-stef commented 2 years ago

AC searches every file in the home (a.k.a profile) directory at first. Then in mod directories (if any are specified). Then in the working directory (which should be the root of the installed game). This way, files in home have priority over files from the original install. But this also leads to a lot of failed file lookups ;)

ac-stef commented 2 years ago

Support for loading PNGs is provided by SDL_image. Lots of room for issues here...

kas1e commented 2 years ago

Hm strange... By strange I mean our version of SDL2_image is very well tested... Maybe something bad still happens like can't open some .png and fail with malloc.. I build with debug symbols and test , that what i have:

    ac_client:png_malloc()+0x1c (section 1 @ 0x438EA8)
    ac_client:png_read_start_row()+0x290 (section 1 @ 0x44936C)
    ac_client:png_read_update_info()+0x50 (section 1 @ 0x43B340)
    ac_client:IMG_LoadPNG_RW()+0x26c (section 1 @ 0x3A43F4)
    ac_client:IMG_LoadTyped_RW()+0xb4 (section 1 @ 0x39C2DC)
    [texture.cpp:357] ac_client:_Z11loadsurfacePKcRiS1_S1_ibbfb()+0x130 (section 1 @ 0x12E3C0)
    [texture.cpp:413] ac_client:_Z11textureloadPKcibbfb()+0x158 (section 1 @ 0x12EAA0)
    [renderhud.cpp:170] ac_client:_Z13loadcrosshairPKcS0_()+0x344 (section 1 @ 0xB3D18)
    [command.cpp:570] ac_client:_Z10executeretPKc()+0x1000 (section 1 @ 0x49C84)
    [command.cpp:666] ac_client:_Z8execfilePKc()+0xac (section 1 @ 0x4B8EC)
    [command.cpp:975] ac_client:_Z4execPKc()+0x18 (section 1 @ 0x4BAFC)
    [main.cpp:1435] ac_client:main()+0x16f0 (section 1 @ 0x805D8)

See, it tried to do loadcrosshair(), then textureload(), then loadsurface() and then crashes. In the "data" register my debugger show "0x00000010" which almost definitely means ~null pointer or bad memory access.

The last line on which we crash is line 357 in texture.cpp , which is :

else if(!s) s = IMG_Load(ffile);

I added printf of file name before IMG_Load(ffile) call, and it return me correctly:

packages/crosshairs/teammate.png

and i checked, file is here. strange!

ac-stef commented 2 years ago

That definitely looks like SDL_image has a problem with that PNG file. I'd try to replace the file with various other PNG files to find out, if there's a special type of PNG that triggers that fault. For example, just load the file with an image editor and then save it again.

Or check with the people from your SDL_image port. Send them our PNG.

kas1e commented 2 years ago

Seems it's not SDL2_image. I just checked it:

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <cstdio>
#include <string>

#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480

SDL_Window *window = NULL;
SDL_Surface *screenSurface = NULL;

static bool init() {
  if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError());
    return false;
  }
  if (!(IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG)) {
    fprintf(stderr, "could not initialize sdl2_image: %s\n", IMG_GetError());
    return false;
  }
  window = SDL_CreateWindow(
    "hello_sdl2",
    SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
    SCREEN_WIDTH, SCREEN_HEIGHT,
    SDL_WINDOW_SHOWN
    );
  if (window == NULL) {
    fprintf(stderr, "could not create window: %s\n", SDL_GetError());
    return false;
  }
  screenSurface = SDL_GetWindowSurface(window);
  if (screenSurface == NULL) {
    fprintf(stderr, "could not get window: %s\n", SDL_GetError());
    return false;
  }
  return true;
}

static SDL_Surface* loadImage(std::string path) {
  SDL_Surface* img = IMG_Load(path.c_str());
  if (img == NULL) {
    fprintf(stderr, "could not load image: %s\n", IMG_GetError());
    return NULL;
  }
  SDL_Surface* optimizedImg = SDL_ConvertSurface(img, screenSurface->format, 0);
  if (optimizedImg == NULL) fprintf(stderr, "could not optimize image: %s\n", SDL_GetError());
  SDL_FreeSurface(img);
  return optimizedImg;
}

static void close() {
  SDL_FreeSurface(screenSurface); screenSurface = NULL;
  SDL_DestroyWindow(window); window = NULL;
  SDL_Quit();
}

int main(int argc, char* args[]) {
  if (!init()) return 1;
  SDL_Surface* img = loadImage("packages/crosshairs/teammate.png");
  if (img == NULL) return 1;
  SDL_BlitSurface(img, NULL, screenSurface, NULL);
  SDL_UpdateWindowSurface(window);
  SDL_Delay(2000);
  SDL_FreeSurface(img); img = NULL;
  close();
  return 0;
} 

And an image from AC loads up just fine. So it looks like something early happens... Damn..

kas1e commented 2 years ago

i think i may try to build AC1.3 for PPC-Linux first to see if it is Endian safe or not. Then can try to add our readdir change etc and then things will be more clear.

ac-stef commented 2 years ago

Did you try to substitute teammate.png?

kas1e commented 2 years ago

Yes. Same result. And "Success" word was also trashed (first 2 letters). Need to check on PPC unix)

ac-stef commented 2 years ago

Until you figure out, how a proper breakpoint for a powerpc would have to look like, you could just use this in tools.h to check assertions: #define ASSERT(c) if(!(c)) { fflush(NULL); fatal("assert"); }

Compiling in debug mode may provide some insights in what's going wrong here.

kas1e commented 2 years ago

Tested on PPC Linux - all fine :( Damn .. that Means that is not Endian-related but somethng local. Though I didn't change makefile as on my platform but well ..

Maybe it can be something related to the "pates/slashes/etc" ? On AmigaOS we have PROGDIR: as the current one and didn't have "//" or "\" or "/" for root. Maybe something with homedIr .. (which we usually just set to PROGDIR:). dunno wIll try to debug.