ptitSeb / prototype

ProtoType (RType remake) version for Linux, Pandora, ODroid, AmigaOS4 and Emscripten. Status: Working.
http://ptitseb.github.io/prototype/
16 stars 8 forks source link

amigaos4 port #1

Closed kas1e closed 5 years ago

kas1e commented 5 years ago

Hi!

Trying to port Prototype to amigaos4 via gl4es, and , have some issues on linking stage. While all objects compiles fine, i can't have final binary, as it give me conflicts with libgl4es.a:

$ make ppc-amigaos-gcc -O2 -fsigned-char -g -ffast-math -I./ -Wno-write-strings -DNO_FMOD -c Engine.cpp Linking prototype ... ppc-amigaos-gcc -static -o prototype AnimGenerator.o Font.o Serpent.o Beam.o FrontEnd.o SolarFlare.o Boss.o Game.o Sound.o BrainBoss.o Generator.o SpaceTrash.o BrainCell.o Geo2D.o Sperm.o BreakScenery.o Geo2D_Draw.o Sprite.o Bug.o HUD.o SpriteEffect.o Bullet.o LadyBird.o SpriteSheet.o Button.o Log.o StarBurst.o CheckPoint.o Map.o stdafx.o Debris.o MidBoss.o SuperTurret.o Demo.o Orb.o Timer.o Editor_Anims.o Player.o TriggerSlowDown.o Editor.o PostEffects.o TriggerSpeedUp.o Editor_EntityProperties.o PowerDroid.o Turret.o Engine.o PowerUp.o UTIL_bitop.o Engine_Generators.o Profiler.o UTIL_Fade.o Entity.o ProtoType.o UTIL_Misc.o Explosion.o RandExplosion.o UTIL_openGL.o Fighter.o Rhino.o UTIL_SDL.o firebug.o Rocket.o Fire.o Serializer.o libILUT.a libILU.a libIL.a -lSDL_image -lwebp -lpng12 -ltiff -ljpeg_8b -lSDL_mixer -lmikmod -lmodplug -lvorbisfile -lvorbis -logg -lflac -lsmpeg libSDL.a libgl4es.a -lstdc++ -lz

libgl4es.a(framebuffers.o): In function glGenFramebuffersEXT': framebuffers.c:(.text+0xb4c): multiple definition ofglGenFramebuffers' Engine.o:/d/prototype-master/Engine.cpp:436: first defined here /usr/local/amiga/lib/gcc/ppc-amigaos/4.4.3/../../../../ppc-amigaos/bin/ld: Warning: size of symbol glGenFramebuffers' changed from 4 in Engine.o to 332 in libgl4es.a(framebuffers.o) /usr/local/amiga/lib/gcc/ppc-amigaos/4.4.3/../../../../ppc-amigaos/bin/ld: Warning: type of symbolglGenFramebuffers' changed from 1 to 2 in libgl4es.a(framebuffers.o)

libgl4es.a(framebuffers.o): In function glDeleteFramebuffersEXT': framebuffers.c:(.text+0x31a4): multiple definition ofglDeleteFramebuffers' Engine.o:/d/prototype-master/Engine.cpp:436: first defined here /usr/local/amiga/lib/gcc/ppc-amigaos/4.4.3/../../../../ppc-amigaos/bin/ld: Warning: size of symbol glDeleteFramebuffers' changed from 4 in Engine.o to 464 in libgl4es.a(framebuffers.o) /usr/local/amiga/lib/gcc/ppc-amigaos/4.4.3/../../../../ppc-amigaos/bin/ld: Warning: type of symbolglDeleteFramebuffers' changed from 1 to 2 in libgl4es.a(framebuffers.o)

libgl4es.a(framebuffers.o): In function glIsFramebufferEXT': framebuffers.c:(.text+0xa8c): multiple definition ofglIsFramebuffer' Engine.o:/d/prototype-master/Engine.cpp:436: first defined here /usr/local/amiga/lib/gcc/ppc-amigaos/4.4.3/../../../../ppc-amigaos/bin/ld: Warning: size of symbol glIsFramebuffer' changed from 4 in Engine.o to 192 in libgl4es.a(framebuffers.o) /usr/local/amiga/lib/gcc/ppc-amigaos/4.4.3/../../../../ppc-amigaos/bin/ld: Warning: type of symbolglIsFramebuffer' changed from 1 to 2 in libgl4es.a(framebuffers.o)

libgl4es.a(framebuffers.o): In function glCheckFramebufferStatusEXT': framebuffers.c:(.text+0x9cc): multiple definition ofglCheckFramebufferStatus' Engine.o:/d/prototype-master/Engine.cpp:717: first defined here /usr/local/amiga/lib/gcc/ppc-amigaos/4.4.3/../../../../ppc-amigaos/bin/ld: Warning: size of symbol glCheckFramebufferStatus' changed from 4 in Engine.o to 192in libgl4es.a(framebuffers.o) /usr/local/amiga/lib/gcc/ppc-amigaos/4.4.3/../../../../ppc-amigaos/bin/ld: Warning: type of symbolglCheckFramebufferStatus' changed from 1 to 2 in libgl4es.a(framebuffers.o)

libgl4es.a(framebuffers.o): In function glBindFramebufferEXT': framebuffers.c:(.text+0x2264): multiple definition ofglBindFramebuffer' Engine.o:/d/prototype-master/Engine.cpp:436: first defined here /usr/local/amiga/lib/gcc/ppc-amigaos/4.4.3/../../../../ppc-amigaos/bin/ld: Warning: size of symbol glBindFramebuffer' changed from 4 in Engine.o to 680 in libgl4es.a(framebuffers.o) /usr/local/amiga/lib/gcc/ppc-amigaos/4.4.3/../../../../ppc-amigaos/bin/ld: Warning: type of symbolglBindFramebuffer' changed from 1 to 2 in libgl4es.a(framebuffers.o)

And so on .. Probabaly something wrong on my side, just can't get what ..

ptitSeb commented 5 years ago

Mmmm yeah, because gl4es is a static, there is a collision between the Framebuffer Symbol from gl4es and the one defined inside prototype. I can add some #ifdef AMIGAOS4 in gl4es around Framebuffers function, the "direct wrapper" zone in framebuffer.c from line 1273 to 1291 (but they may be missing for some other programs).

EDIT Or maybe I have to do the Framebuffer stuff in a better way in Prototype, using function pointer like all programs do.

kas1e commented 5 years ago

Yeah sure better to make changes in Prototype instead of gl4es, gl4es is more general thing, the less "ifdefs" in , and diffrent os specific parts the better :)

ptitSeb commented 5 years ago

Should be fixed with commit 2151c8ab723bfae18376bf16d2bd071f3a646dd0

kas1e commented 5 years ago

Yeah, thanks, now it links fine. Through crashes heavy at start after saying [Initialiing SDL_Mixer] Complete ..

I use SDL1 for now, and already do some amigaos4 ifdefs where "getenv("HOME"); is used, as we don't have that one, and instead we use "PROGDIR:" as meaning of "current dir". So that what i do:

Engine.cpp:

ifdef amigaos4

snprintf(enginepath, PATH_MAX, "%s.prototype/Engine.cfg", "PROGDIR:");

else

snprintf(enginepath, PATH_MAX, "%s/.prototype/Engine.cfg", getenv("HOME"));

endif

ifdef amigaos4

snprintf(controlspath, PATH_MAX, "%s.prototype/Controls.cfg", "PROGDIR:");

else

snprintf(controlspath, PATH_MAX, "%s/.prototype/Controls.cfg", getenv("HOME"));

endif

ifdef amigaos4

snprintf(scorepath, PATH_MAX, "%s.prototype/score.dat", "PROGDIR:");

else

snprintf(scorepath, PATH_MAX, "%s/.prototype/score.dat", getenv("HOME"));

endif

ifdef amigaos4

snprintf(scorepath, PATH_MAX, "%s.prototype/score.dat", "PROGDIR:");

else

snprintf(scorepath, PATH_MAX, "%s/.prototype/score.dat", getenv("HOME"));

endif

FrontEnd.cpp:

ifdef amigaos4

snprintf(controlspath, PATH_MAX, "%s.prototype/Controls.cfg", "PROGDIR:");

else

snprintf(controlspath, PATH_MAX, "%s/.prototype/Controls.cfg", getenv("HOME"));

endif

Log.cpp:

ifdef amigaos4

snprintf(logpath, PATH_MAX, "%s.prototype/Logfile.txt", "PROGDIR:");

else

snprintf(logpath, PATH_MAX, "%s/.prototype/Logfile.txt", getenv("HOME"));

endif

Prototype.cpp:

ifdef amigaos4

snprintf(cfg_path, PATH_MAX, "%s.prototype", "PROGDIR:");

else

snprintf(cfg_path, PATH_MAX, "%s/.prototype/", getenv("HOME"));

endif

If you can , maybe you can add those ifdef to the repo as well, so if we will change later anyything in those files, i will have no needs to made that changes always.

Maybe i should try to build SDL2 version instead ?

kas1e commented 5 years ago

Maybe it crashes when want to generate .prototype/ files like score.dat and co, and by some reassons can't, like big-endian not aware or something ?

ptitSeb commented 5 years ago

So, I can add the amigaos4 define stuff, sure. But "PROGDIR:" is really what should be used? Doesn't it better when you separate program and data? Also, I'll add a "if" in the Makefile too, so to build you use make AMIGAOS4=1 What changes have you made to the Makefile so I can add them too?

For the crash, yes, that seems related to the file reading. I'll try to check what is appening.

ptitSeb commented 5 years ago

Anyway, try this commit 0f8640ac7181b403d6494e0340ca592afda93f90 And tell me what is to be changed in the Makefile For the crash, maybe the crash is at the creation of the ".prototype" folder? In the code, if one of the cfg or log file is not present, it should be created (look in line 198 of Serializer.cpp).

kas1e commented 5 years ago

So, I can add the amigaos4 define stuff, sure. But "PROGDIR:" is really what should be used? Doesn't it better when you separate program and data?

Yeah that way is ok, on amigaos4 we do not have any kind o "home" or any user specific places, as there is one user for all the time. So to not fill up system parition with all kind of temporary and game datas, we instead we put always all the necessary data inside of the program's directory, so to not create files anywhere else.

What changes have you made to the Makefile so I can add them too?

For first :

CPP = ppc-amigaos-gcc LD = ppc-amigaos-gcc -static

Then LDFLAGS are:

LDFLAGS += -lSDL_image -lwebp -lpng12 -ltiff -ljpeg_8b -lSDL_mixer -lmikmod -lmodplug -lvorbisfile -lvorbis -logg -lflac -lsmpeg libSDL.a libgl4es.a -lstdc++ -lz

I also tried to build SDL2 version, and there need to be done one change in Sound.h file:

pragma once

ifdef NO_FMOD

ifdef USE_SDL2

include <SDL2/SDL_mixer.h>

else

include <SDL/SDL_mixer.h>

endif

else

include

endif

include

At least on amiagos4 SDL_mixer for SDL2 placed in the SDL2 directory.. Not big deal, but maybe worth of change..

For SDL2 buld on amiagos4 ldflags are:

-lSDL2_image -lwebp -lpng12 -ltiff -ljpeg_8b -lSDL2_mixer -lmikmod -lmodplug -lvorbisfile -lvorbis -logg -lflac -lsmpeg2 libSDL2.a libgl4es.a -lpthread -lstdc++ -lz

Through, sadly, SDL2 version crashes the same. And its alway randomly for both versions be it sdl1 or sdl2 : sometime it lockups after "joystick init", sometime after "sdl_mixer initialisation complete" , sometime after "no score.data, generating". But what is always the same, is that there is lots of bad accesses to the memory come, and one time i even catch the crashlog : it point out on lots of "strcasecmp()" functions.

If i manually create ".prototype" directory in the root, it make no differences, so its not create-dir related too ..

I also need to note (just in case), that i had to disable in the LibDevel one function to be able to build it with gl4es, as i at moment didn't have "GLU" for it, and in LibDevel there is one GLU function used:

src-ILUT/src/ilut_opengl.h:

ILboolean ILAPIENTRY ilutGLBuildMipmaps() { ILimage *Image;

ilutCurImage = ilGetCurImage();
if (ilutCurImage == NULL) {
    ilSetError(ILUT_ILLEGAL_OPERATION);
    return IL_FALSE;
}

Image = MakeGLCompliant2D(ilutCurImage);
if (Image == NULL)
    return IL_FALSE;

ifndef amigaos4

gluBuild2DMipmaps(GL_TEXTURE_2D, ilutGLFormat(Image->Format, Image->Bpp), Image->Width,
                    Image->Height, Image->Format, Image->Type, Image->Data);

endif

if (Image != ilutCurImage)
    ilCloseImage(Image);

return IL_TRUE;

}

I.e. i disable gluBuild2DMipmaps, but that one for sure should't cause such crashes , etc, all what it can cause is some visual problems, if any.

ptitSeb commented 5 years ago

Ok, I'll add the Makefile and SDL2 change for AmigaOS4 soon.

About the GLU stuff, you need to upload the image at least, if you don't want (or can) use gluBuild2DMipmaps (see https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluBuild2DMipmaps.xml for what this function does).

So more something like:

#ifdef amigaos4
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, ilutGLFormat(Image->Format, Image->Bpp), Image->Width,
Image->Height, 0, Image->Format, Image->Type, Image->Data);
#else
gluBuild2DMipmaps(GL_TEXTURE_2D, ilutGLFormat(Image->Format, Image->Bpp), Image->Width,
Image->Height, Image->Format, Image->Type, Image->Data);
#endif
ptitSeb commented 5 years ago

the -lpthread is only for SDL2 config?

kas1e commented 5 years ago

the -lpthread is only for SDL2 config?

Yes, SDL1 without , SDL2 with.

Thanks for gluBuild2DMipmaps() replace, rebuild LibDevil wih it.

For now trying to run Prototype again, and it just crashes right after it do "Resolution set: 640x480x32", saying "Complete..", then long long waiting (lots of bad memory accesses), and then says words about FrameBuffer, etc, Searching for joystick, and again lots of bad memory accesses in loop ..

kas1e commented 5 years ago

Btw, for SDL2 build there is also "-lsmpeg2" , with 2 at end (for SDL1 -lsmpeg , without 2 at end)

ptitSeb commented 5 years ago

Ok, I made the changes to the Makefile.

For the crash, my log of a run on the Pandora is there:

LIBGL: Initialising gl4es
LIBGL: v1.1.1 built on Oct 20 2018 16:34:48
LIBGL: framebuffer output enabled
LIBGL: Using GLES 2.0 backend
LIBGL:loaded: libGLESv2.so
LIBGL:loaded: libEGL.so
LIBGL: Using GLES 2.0 backend
LIBGL: Hardware Limited NPOT detected and used
LIBGL: Extension GL_EXT_blend_minmax detected and used
LIBGL: FBO are in core, and so used
LIBGL: PointSprite are in core, and so used
LIBGL: CubeMap are in core, and so used
LIBGL: BlendColor is in core, and so used
LIBGL: Blend Substract is in core, and so used
LIBGL: Blend Function and Equation Separation is in core, and so used
LIBGL: Texture Mirrored Repeat is in core, and so used
LIBGL: Extension GL_OES_mapbuffer detected
LIBGL: Extension GL_OES_element_index_uint detected and used
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_OES_depth24 detected and used
LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
LIBGL: Extension GL_EXT_multi_draw_arrays detected
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected and used
LIBGL: Extension GL_OES_depth_texture detected and used
LIBGL: Extension GL_EXT_texture_rg detected and used
LIBGL: Extension GL_OES_texture_float detected and used
LIBGL: Extension GL_OES_texture_half_float detected and used
LIBGL: Extension GL_OES_fragment_precision_high detected and used
LIBGL: Max vertex attrib: 16
LIBGL: Extension GL_OES_standard_derivatives detected and used
LIBGL: Max texture size: 2048
LIBGL: Max Varying Vector: 8
LIBGL: Texture Units: 8(8), Max lights: 8, Max planes: 6
LIBGL: Hardware vendor is Imagination Technologies
LIBGL: Targeting OpenGL 2.0
LIBGL: Forcing NPOT support by disabling MIPMAP support for NPOT textures
LIBGL: glXMakeCurrent FBO workaround enabled
LIBGL: Current folder is:/media/sda1/sources/git/prototype
Vsync read from file /mnt/utmp/codeblocks/home/.prototype/Engine.cfg
PBuffers read from file /mnt/utmp/codeblocks/home/.prototype/Engine.cfg
ShowFPS read from file /mnt/utmp/codeblocks/home/.prototype/Engine.cfg
Fullscreen read from file /mnt/utmp/codeblocks/home/.prototype/Engine.cfg
Scanlines read from file /mnt/utmp/codeblocks/home/.prototype/Engine.cfg
Keeplog read from file /mnt/utmp/codeblocks/home/.prototype/Engine.cfg
Joystick read from file /mnt/utmp/codeblocks/home/.prototype/Engine.cfg
>>Logging Enabled<<

[Initializing Video Settings]
Resolution Set: 800x480x32
Complete...

Framebuffer pMainTarget result=0x8CD5
Framebuffer pPostTarget result=0x8CD5
Framebuffer p64x64Target result=0x8CD5
Framebuffer p256x256Target result=0x8CD5

[Searching for Joystick]
No joysticks found...
UP_Primary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
UP_Secondary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
DOWN_Primary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
DOWN_Secondary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
RIGHT_Primary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
RIGHT_Secondary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
LEFT_Primary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
LEFT_Secondary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
ATTACK_Primary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
ATTACK_Secondary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
ATTACK2_Primary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg
ATTACK2_Secondary read from file /mnt/utmp/codeblocks/home/.prototype/Controls.cfg

[Initializing Devil]
Complete...

[Initializing SDL_Mixer]
Complete...

1a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Failed to read 1b from file /mnt/utmp/codeblocks/home/.prototype/score.dat
2a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Failed to read 2b from file /mnt/utmp/codeblocks/home/.prototype/score.dat
3a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Failed to read 3b from file /mnt/utmp/codeblocks/home/.prototype/score.dat
4a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Failed to read 4b from file /mnt/utmp/codeblocks/home/.prototype/score.dat
5a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Failed to read 5b from file /mnt/utmp/codeblocks/home/.prototype/score.dat
6a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Failed to read 6b from file /mnt/utmp/codeblocks/home/.prototype/score.dat
7a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Failed to read 7b from file /mnt/utmp/codeblocks/home/.prototype/score.dat
8a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Failed to read 8b from file /mnt/utmp/codeblocks/home/.prototype/score.dat
9a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Failed to read 9b from file /mnt/utmp/codeblocks/home/.prototype/score.dat
10a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Failed to read 10b from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Image Loaded:Data/Gfx/Fonts.psd.
Image Loaded: Data/Gfx/FontShadow.psd.
Image Loaded:Data/Gfx/Fonts2.psd.
Image Loaded: Data/Gfx/Fonts2Shadow.psd.
Image Loaded: Data/Gfx/GUI.psd
Image Loaded: Data/Gfx/Scanlines.psd
Image Loaded: Data/Gfx/HudBeam.png
Image Loaded: Data/Gfx/PlayerShip.png
Image Loaded: Data/Gfx/ForceCharge.png
Image Loaded: Data/Gfx/Orb1.png
Image Loaded: Data/Gfx/ChainParticle.png
Image Loaded: Data/Gfx/LadyBird.png
Image Loaded: Data/Gfx/turret1.png
Image Loaded: Data/Gfx/SuperTurret.png
Image Loaded: Data/Gfx/SerpentHead.png
Image Loaded: Data/Gfx/SerpentBody.png
Image Loaded: Data/Gfx/SerpentTail.png
Image Loaded: Data/Gfx/Rocket.png
Image Loaded: Data/Gfx/GroundTroop_Walk.png
Image Loaded: Data/Gfx/GroundTroop_Turn.png
Image Loaded: Data/Gfx/GroundTroop_Aim.png
Image Loaded: Data/Gfx/PowerDroid.png
Image Loaded: Data/Gfx/Bug.png
Image Loaded: Data/Gfx/Starburst.png
Image Loaded: Data/Gfx/Fighter.png
Image Loaded: Data/Gfx/RoboticTorso.png
Image Loaded: Data/Gfx/Thruster.png
Image Loaded: Data/Gfx/Boss.png
Image Loaded: Data/Gfx/BossTube.psd
Image Loaded: Data/Gfx/BossTubeSpec.png
Image Loaded: Data/Gfx/BossTubeFluid.png
Image Loaded: Data/Gfx/BossArm.png
Image Loaded: Data/Gfx/BossPush.png
Image Loaded: Data/Gfx/BossEye1.png
Image Loaded: Data/Gfx/BossEye2.png
Image Loaded: Data/Gfx/BossEye3.png
Image Loaded: Data/Gfx/BossEye4.png
Image Loaded: Data/Gfx/BossEye5.png
Image Loaded: Data/Gfx/BossCharge.png
Image Loaded: Data/Gfx/BossBrain.png
Image Loaded: Data/Gfx/BossBrainCell.png
Image Loaded: Data/Gfx/BossSperm.png
Image Loaded: Data/Gfx/FireBug.png
Image Loaded: Data/Gfx/SpaceTrash.png
Image Loaded: Data/Gfx/MidBoss.png
Image Loaded: Data/Gfx/MidBossSeg.png
Image Loaded: Data/Gfx/MidBossCore.png
Image Loaded: Data/Gfx/MidBossGun.png
Image Loaded: Data/Gfx/MidBossFoot.png
Image Loaded: Data/Gfx/BulletSet1.png
Image Loaded: Data/Gfx/Forceblast.png
Image Loaded: Data/Gfx/GlowBullets.png
Image Loaded: Data/Gfx/BulletHit.png
Image Loaded: Data/Gfx/BulletHit2.png
Image Loaded: Data/Gfx/BulletHit3.png
Image Loaded: Data/Gfx/ClusterBomb.png
Image Loaded: Data/Gfx/Missile.png
Image Loaded: Data/Gfx/FireBall.png
Image Loaded: Data/Gfx/HomingMissile.png
Image Loaded: Data/Gfx/PowerUp1.png
Image Loaded: Data/Gfx/BitUpgrade.png
Image Loaded: Data/Gfx/ExplosionSmall.psd
Image Loaded: Data/Gfx/Explosion2.png
Image Loaded: Data/Gfx/Implosion.png
Image Loaded: Data/Gfx/BlueExplosion.png
Image Loaded: Data/Gfx/SmokePuff.png
Image Loaded: Data/Gfx/PlayerSpeed.png
Image Loaded: Data/Gfx/Anim_back1.png
Image Loaded: Data/Gfx/Anim_back2.png
Image Loaded: Data/Gfx/Anim_Fore1.png
Image Loaded: Data/Gfx/Anim_Fore2.png
Image Loaded: Data/Gfx/Anim_Fore3.png
Image Loaded: Data/Gfx/DamageTile1.png
Image Loaded: Data/Gfx/water.png
Image Loaded: Data/Gfx/watersplash.png
Image Loaded: Data/Gfx/Splash.psd
Image Loaded: Data/Gfx/Fire.png
Image Loaded: Data/Gfx/SplashBack.png
Image Loaded: Data/Gfx/Stage1.psd
Image Loaded: Data/Gfx/GameOver.psd
Image Loaded: Data/Gfx/Prototypemk1.png
Image Loaded: Data/Gfx/Congrats.png
Image Loaded: Data/Gfx/GameOverSeq.png
Image Loaded: Data/Gfx/HiScoreSeq.png
Image Loaded: Data/Gfx/LiftOff2.png
Image Loaded: Data/Gfx/LiftOff.png
Image Loaded: Data/Gfx/Stage1Layer1.png
Total Texture Mem usage:28

[Engine Shutdown]
1a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
1b read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
2a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
2b read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
3a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
3b read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
4a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
4b read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
5a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
5b read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
6a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
6b read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
7a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
7b read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
8a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
8b read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
9a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
9b read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
10a read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
10b read from file /mnt/utmp/codeblocks/home/.prototype/score.dat
Complete...

Can you copy/paste Amiga log or is the crash a system crash, so no log?

ptitSeb commented 5 years ago

@kas1e with commit 6f266b3e64d79270d2888d6f3ea70c8e70bb69d1, Devil is completely removed (and GLU too). Maybe it will work better for youthis way.

kas1e commented 5 years ago

Woah ! Good news ! With removed Devil , it now starts !

Didn't crashes, show me intro, then start menu. I can choice confiure, etc, but when i choice "start game" , then i have black window with word "LOADING...", and nothing happens. I wait for about 5 minutes. No crashes, nothing happens, just black window and "LOADING.."

ptitSeb commented 5 years ago

"Loading .." writen in bleu in the lower left corner?

Are you using SDL1 or SDL2?

kas1e commented 5 years ago

"Loading .." writen in bleu in the lower left corner?

Yes

Are you using SDL1 or SDL2?

SDL1 for now

ptitSeb commented 5 years ago

The loading of the level is here: void Engine::StartGame() (line 16 of Game.cpp) Can you put some printf(...) to see where it is stuck?

kas1e commented 5 years ago

It stuck inside of LoadMapData(),it reach inside of it "read block data" part, there is waiting for about 30 seconds, then it say "before read entities", and there it stuck forever

kas1e commented 5 years ago

Maybe that "ReadBinary" is not big-endian aware ?

ptitSeb commented 5 years ago

Yeah, ReadBinary doesn't seem BigEndian aware...

ptitSeb commented 5 years ago

Try with commit dd3437d533518841373a787b22e02f4b806deb70 hopefully it will fix BigEndian reading of datafiles.

kas1e commented 5 years ago

Thanks, replaced FileIO.h with new one, do whole rebuild of game, but sadly nothing changs :( Its the same about 10-20 seconds stuck before "read block data", then i have "before read entities" and nothing happens after.

kas1e commented 5 years ago

I also put many printfs inside of the loop where it stuck, like this:

printf("before read entities\n");
//read entities
int numEnt,n;
fIO.ReadBinary(&numEnt,1);
printf("after fio.ReadBinary\n");

for(n=0;n<numEnt;n++)
{
    Generator g;
    printf("before g.LoadFromFile\n");
    g.LoadFromFile(fIO);
    printf("before mGenerators.push_back(g)\n");
    mGenerators.push_back(g);
}
printf("before readbinary\n");

And that output i have after which nothing happens:

4/0.Work:prototype> prototype_gl4es_sdl1 LIBGL: Initialising gl4es LIBGL: v1.0.9 built on Oct 28 2018 16:52:39 LIBGL: Using GLES 2.0 backend LIBGL: OGLES2 Library and Interface open successfuly LIBGL: Targeting OpenGL 2.0 LIBGL: Forcing NPOT support by disabling MIPMAP support for NPOT textures LIBGL: Current folder is:Work:prototype Will create PROGDIR:.prototype folder winWidth read from file PROGDIR:.prototype/Engine.cfg winHeight read from file PROGDIR:.prototype/Engine.cfg bpp read from file PROGDIR:.prototype/Engine.cfg Vsync read from file PROGDIR:.prototype/Engine.cfg PBuffers read from file PROGDIR:.prototype/Engine.cfg ShowFPS read from file PROGDIR:.prototype/Engine.cfg Fullscreen read from file PROGDIR:.prototype/Engine.cfg Scanlines read from file PROGDIR:.prototype/Engine.cfg Keeplog read from file PROGDIR:.prototype/Engine.cfg Joystick read from file PROGDIR:.prototype/Engine.cfg

Logging Enabled<<

[Initializing Video Settings] LIBGL: Hardware test on current Context... LIBGL: Hardware Limited NPOT detected and used LIBGL: FBO are in core, and so used LIBGL: PointSprite are in core, and so used LIBGL: CubeMap are in core, and so used LIBGL: BlendColor is in core, and so used LIBGL: Blend Substract is in core, and so used LIBGL: Blend Function and Equation Separation is in core, and so used LIBGL: Texture Mirrored Repeat is in core, and so used LIBGL: Extension GL_OES_element_index_uint detected and used LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected and used LIBGL: Extension GL_OES_texture_float detected and used LIBGL: high precision float in fragment shader available and used LIBGL: Extension GL_EXT_frag_depth detected and used LIBGL: Max vertex attrib: 16 LIBGL: Max texture size: 16384 LIBGL: Max Varying Vector: 32 LIBGL: Texture Units: 8(8), Max lights: 8, Max planes: 6 LIBGL: Max Anisotropic filtering: 16 LIBGL: Hardware vendor is A-EON Technology Ltd. Written by Daniel 'Daytonta675x' MьЯener @ GoldenCode.eu Resolution Set: 640x480x32 Complete...

Framebuffer pMainTarget result=0x8CD5 Framebuffer pPostTarget result=0x8CD5 Framebuffer p64x64Target result=0x8CD5 Framebuffer p256x256Target result=0x8CD5

[Searching for Joystick] No joysticks found... UP_Primary read from file PROGDIR:.prototype/Controls.cfg UP_Secondary read from file PROGDIR:.prototype/Controls.cfg DOWN_Primary read from file PROGDIR:.prototype/Controls.cfg DOWN_Secondary read from file PROGDIR:.prototype/Controls.cfg RIGHT_Primary read from file PROGDIR:.prototype/Controls.cfg RIGHT_Secondary read from file PROGDIR:.prototype/Controls.cfg LEFT_Primary read from file PROGDIR:.prototype/Controls.cfg LEFT_Secondary read from file PROGDIR:.prototype/Controls.cfg ATTACK_Primary read from file PROGDIR:.prototype/Controls.cfg ATTACK_Secondary read from file PROGDIR:.prototype/Controls.cfg ATTACK2_Primary read from file PROGDIR:.prototype/Controls.cfg ATTACK2_Secondary read from file PROGDIR:.prototype/Controls.cfg

[Initializing SDL_Mixer] Complete...

1a read from file PROGDIR:.prototype/score.dat Failed to read 1b from file PROGDIR:.prototype/score.dat 2a read from file PROGDIR:.prototype/score.dat Failed to read 2b from file PROGDIR:.prototype/score.dat 3a read from file PROGDIR:.prototype/score.dat Failed to read 3b from file PROGDIR:.prototype/score.dat 4a read from file PROGDIR:.prototype/score.dat Failed to read 4b from file PROGDIR:.prototype/score.dat 5a read from file PROGDIR:.prototype/score.dat Failed to read 5b from file PROGDIR:.prototype/score.dat 6a read from file PROGDIR:.prototype/score.dat Failed to read 6b from file PROGDIR:.prototype/score.dat 7a read from file PROGDIR:.prototype/score.dat Failed to read 7b from file PROGDIR:.prototype/score.dat 8a read from file PROGDIR:.prototype/score.dat Failed to read 8b from file PROGDIR:.prototype/score.dat 9a read from file PROGDIR:.prototype/score.dat Failed to read 9b from file PROGDIR:.prototype/score.dat 10a read from file PROGDIR:.prototype/score.dat Failed to read 10b from file PROGDIR:.prototype/score.dat Image Loaded:Data/Gfx/Fonts.psd. Image Loaded: Data/Gfx/FontShadow.psd. Image Loaded:Data/Gfx/Fonts2.psd. Image Loaded: Data/Gfx/Fonts2Shadow.psd. Image Loaded: Data/Gfx/GUI.psd Image Loaded: Data/Gfx/Scanlines.psd Image Loaded: Data/Gfx/HudBeam.png Image Loaded: Data/Gfx/PlayerShip.png Image Loaded: Data/Gfx/ForceCharge.png Image Loaded: Data/Gfx/Orb1.png Image Loaded: Data/Gfx/ChainParticle.png Image Loaded: Data/Gfx/LadyBird.png Image Loaded: Data/Gfx/turret1.png Image Loaded: Data/Gfx/SuperTurret.png Image Loaded: Data/Gfx/SerpentHead.png Image Loaded: Data/Gfx/SerpentBody.png Image Loaded: Data/Gfx/SerpentTail.png Image Loaded: Data/Gfx/Rocket.png Image Loaded: Data/Gfx/GroundTroop_Walk.png Image Loaded: Data/Gfx/GroundTroop_Turn.png Image Loaded: Data/Gfx/GroundTroop_Aim.png Image Loaded: Data/Gfx/PowerDroid.png Image Loaded: Data/Gfx/Bug.png Image Loaded: Data/Gfx/Starburst.png Image Loaded: Data/Gfx/Fighter.png Image Loaded: Data/Gfx/RoboticTorso.png Image Loaded: Data/Gfx/Thruster.png Image Loaded: Data/Gfx/Boss.png Image Loaded: Data/Gfx/BossTube.psd Image Loaded: Data/Gfx/BossTubeSpec.png Image Loaded: Data/Gfx/BossTubeFluid.png Image Loaded: Data/Gfx/BossArm.png Image Loaded: Data/Gfx/BossPush.png Image Loaded: Data/Gfx/BossEye1.png Image Loaded: Data/Gfx/BossEye2.png Image Loaded: Data/Gfx/BossEye3.png Image Loaded: Data/Gfx/BossEye4.png Image Loaded: Data/Gfx/BossEye5.png Image Loaded: Data/Gfx/BossCharge.png Image Loaded: Data/Gfx/BossBrain.png Image Loaded: Data/Gfx/BossBrainCell.png Image Loaded: Data/Gfx/BossSperm.png Image Loaded: Data/Gfx/FireBug.png Image Loaded: Data/Gfx/SpaceTrash.png Image Loaded: Data/Gfx/MidBoss.png Image Loaded: Data/Gfx/MidBossSeg.png Image Loaded: Data/Gfx/MidBossCore.png Image Loaded: Data/Gfx/MidBossGun.png Image Loaded: Data/Gfx/MidBossFoot.png Image Loaded: Data/Gfx/BulletSet1.png Image Loaded: Data/Gfx/Forceblast.png Image Loaded: Data/Gfx/GlowBullets.png Image Loaded: Data/Gfx/BulletHit.png Image Loaded: Data/Gfx/BulletHit2.png Image Loaded: Data/Gfx/BulletHit3.png Image Loaded: Data/Gfx/ClusterBomb.png Image Loaded: Data/Gfx/Missile.png Image Loaded: Data/Gfx/FireBall.png Image Loaded: Data/Gfx/HomingMissile.png Image Loaded: Data/Gfx/PowerUp1.png Image Loaded: Data/Gfx/BitUpgrade.png Image Loaded: Data/Gfx/ExplosionSmall.psd Image Loaded: Data/Gfx/Explosion2.png Image Loaded: Data/Gfx/Implosion.png Image Loaded: Data/Gfx/BlueExplosion.png Image Loaded: Data/Gfx/SmokePuff.png Image Loaded: Data/Gfx/PlayerSpeed.png Image Loaded: Data/Gfx/Anim_back1.png Image Loaded: Data/Gfx/Anim_back2.png Image Loaded: Data/Gfx/Anim_Fore1.png Image Loaded: Data/Gfx/Anim_Fore2.png Image Loaded: Data/Gfx/Anim_Fore3.png Image Loaded: Data/Gfx/DamageTile1.png Image Loaded: Data/Gfx/water.png Image Loaded: Data/Gfx/watersplash.png Image Loaded: Data/Gfx/Splash.psd Image Loaded: Data/Gfx/Fire.png Image Loaded: Data/Gfx/SplashBack.png Image Loaded: Data/Gfx/Stage1.psd Image Loaded: Data/Gfx/GameOver.psd Image Loaded: Data/Gfx/Prototypemk1.png Image Loaded: Data/Gfx/Congrats.png Image Loaded: Data/Gfx/GameOverSeq.png Image Loaded: Data/Gfx/HiScoreSeq.png Image Loaded: Data/Gfx/LiftOff2.png Image Loaded: Data/Gfx/LiftOff.png Image Loaded: Data/Gfx/Stage1Layer1.png Total Texture Mem usage:28 we inside of engine::startgame we before LoadMapData() we inside of LoadMapData before ClearMapArrays beforeClearMapEntities before sprintf before read block data before read entities after fio.ReadBinary before g.LoadFromFile before mGenerators.push_back(g) before g.LoadFromFile before mGenerators.push_back(g) before g.LoadFromFile

And those last 2 strings repeats about 350 times each line (i.e. ~350 times loop works), and then it just stops and nothing happens next.

ptitSeb commented 5 years ago

It would be ice to printf the numEnt read, just to be sure. Also, in Generator.cpp, printf the iEntType read line 65, so we can see what entity is still buggy.

kas1e commented 5 years ago

Yep, add printfs of those ints like:

printf("numEnt=%d\n",numEnt);
for(n=0;n<numEnt;n++)
{       
    printf("n=%d\n",n);
    Generator g;
    printf("before g.LoadFromFile\n");
    g.LoadFromFile(fIO);
    printf("before mGenerators.push_back(g)\n");
    mGenerators.push_back(g);
}

and in generator.cpp:

printf("from generator.cpp: iEntType=%d\n",iEntType);

And output are:

http://kas1e.mikendezign.com/aos4/gl4es/games/prototype/prototype_output_1.txt

ptitSeb commented 5 years ago

Mmm, my Little->BigEndian trick is obviously wrong! Look at what I should get for level 1:

numEnt=318
n=0
from generator.cpp: iEntType=1
n=1
from generator.cpp: iEntType=1
n=2
from generator.cpp: iEntType=1
n=3
from generator.cpp: iEntType=1
n=4
from generator.cpp: iEntType=1
n=5
from generator.cpp: iEntType=1
n=6
from generator.cpp: iEntType=1
n=7
from generator.cpp: iEntType=1
n=8
from generator.cpp: iEntType=1
n=9
from generator.cpp: iEntType=5
n=10
from generator.cpp: iEntType=6
n=11
from generator.cpp: iEntType=6
n=12
from generator.cpp: iEntType=3
n=13
from generator.cpp: iEntType=0
n=14
from generator.cpp: iEntType=0
n=15
from generator.cpp: iEntType=0
n=16
from generator.cpp: iEntType=0
n=17
from generator.cpp: iEntType=0
n=18
from generator.cpp: iEntType=0
n=19
from generator.cpp: iEntType=0
n=20
from generator.cpp: iEntType=0
n=21
from generator.cpp: iEntType=0
n=22
from generator.cpp: iEntType=0
n=23
from generator.cpp: iEntType=0

I'll try to fix that stuff.

ptitSeb commented 5 years ago

Ok, should be fixed with commit 37e566c7db03434eeab0698d68a9b23ee1cd3980 (that's what happen when doing stuff late night)

kas1e commented 5 years ago

Yeah ! It works !

Through, maybe there is some issue with alpha channel of some pictures or something .. There is how it looks like for me:

http://kas1e.mikendezign.com/aos4/gl4es/games/prototype/prototype1.jpg

See words "MARS COLONY UNDER ATTACK", are with yellow dots around. If checking all the fonts , there is the same problem. Dunno if it expected to be like this , but looks like something with alpha channel maybe ?

Btw, is there any "FPS" counter for that game ?

ptitSeb commented 5 years ago

Yes, there is an FPS counter. Edit Engine.cfg (so in "PROGDIR:" :p ) you will see the ShowFPS line.

For the font, yeah, there is something odd. Need to analyse how that font is rendered, to understand what's going on, but it seems like is alpha almost 0 (like < 10, but not 0) sudenly is 255. Look a screenshot I have just done on the Pandora: prototype1

kas1e commented 5 years ago

Yeah, now i see that every font have that issue.. Remind me big-endian issues with 16-24 bits, or wrong byte order, like alpha not where it should be..

ptitSeb commented 5 years ago

Yeah, I think it's something like that. Try with this commit: 363cad531d0195c9c1fc0e635318c2d699214587 hopefully that fixed the issue.

kas1e commented 5 years ago

Hm, nope, still the same

kas1e commented 5 years ago

I will try for sake of compare build sdl2 version as well.

Btw, what i notice, is that game leak ram all the time. And only when i exit from game, free the memory. Seems that when level loaded, and then exited from, memory didn't freed. Then level loads again (into the new chunks of memory), and up up, and when exit, only then free all memory. It is the same for you ? You may try to just run it on pandora, and leave it for 10-15 minuts alone ,and then see what happens.

kas1e commented 5 years ago

Tested SDL2 version : same problems with fonts. Probabaly then no SDL issue .. Only what i notice, is that while in SDL1 version, keys w/s/a/d works as well as up/down/left/right , but in SDL2 version, w/s/a/d work, but up/down/left/right not (i mean by default). Is it the same for you ?

kas1e commented 5 years ago

Also for fun check some FPS, there result:

640x480 window mode: title screen: 327 in game: 209-252

800x600 window mode: title screen: 292 in game: 200-222

1024x68 window mode: title screen: 248 in game: 192-205

ptitSeb commented 5 years ago

That's some good framerate. But the game is not too demanding so that was expected.

About memory leak: yeah, I haven't checked but that could be. I'll try to take a look at it later.

For the fonts, well, I need to look a bit deeper probably..

ptitSeb commented 5 years ago

Mmm, I rechecked, and made a capture. I don't think the last code I submited is good, I'll remove it soon.

Also, I think the issue is inside stb_image.h, the artifact you seen is only on PSD image, and stb_image has to recompose the final image by adding all the layer, and I guess there is an issue with BigEndian stuff on that case. I'll see if I can pinpoint the bug, or see to convert files to simple png as a fallback.

ptitSeb commented 5 years ago

So, I haven't found anything wrong :(

Still, to test that theory, I have just pushed a change, where the "STAGE1" picture has been converted from PSD to PNG. Can you check if it's better like this?

kas1e commented 5 years ago

There is result: http://kas1e.mikendezign.com/aos4/gl4es/games/prototype/prototype2.jpg

Seems theory is right

ptitSeb commented 5 years ago

Ok good, I'll do the rest of the files tonight.

ptitSeb commented 5 years ago

So with commit 9970d39c4c80e4b40a673cf24b256f2191514a74 I removed all PSD, so it should be good now (for packaging, you normally just need the Data folder along with the executable).

kas1e commented 5 years ago

Retested: something wrong seems so. I didn't have words "Loading" anymore (like alpha now full transparet). Then once i hit enter, i have protype words ok, but menu have only empty areas, no fonts. And when press on area where start game placed i can't see any fonts. Ship flys ok, enemies too, but no fonts anywhere, just transparently.

For sake of tests i rebuild everything from scratch again - the same :(

ptitSeb commented 5 years ago

And you have all the new png in place (like Data/Gfx/Fonts.png ) and the loading of the file is all ok?

I tested on my side before pushing and it was working fine, so I'm puzzled (also, looking at Fonts.png and FontShadow.png content in github and it looks fine to me).

ptitSeb commented 5 years ago

Mmm, it seems the fonts are in gray+alpha instead of color+alpha, so I guess that's the issue (bigendian stuff probably). I'll convert them to color+gray and that should fix it for good.

ptitSeb commented 5 years ago

Ok, commit 679054b1e25780401d14bef89e6fd3fdb9bf768e should do the trick.

kas1e commented 5 years ago

Sadly, still the same. It only chaneg the look of the menus areas (now they looks correct, before was a bit stretched). But no fonts still, not "loading", not fonts in game. All other textures fine, and looks correct now, just something with fonts.

kas1e commented 5 years ago

I can try to redownload everything from latest commit, and rebuild in another directory, in hope that something can go wrong on my side, and just to be sure that there is still issue ..

kas1e commented 5 years ago

Ok, rebuild everything from scratch with redownloaded latest commit : all fine ! Always good to do recompile of clear redownload just in case :)

Thanks a bunch for your time, it seems all works fine now. At least that how it looks like for me now:

http://kas1e.mikendezign.com/aos4/gl4es/games/prototype/prototype3.jpg http://kas1e.mikendezign.com/aos4/gl4es/games/prototype/prototype4.jpg

Seems all correct ?

ptitSeb commented 5 years ago

Great!

As far as I can say, yes, this seems 100% correct :)