Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amigaos4 build #21

Open
kas1e opened this issue Nov 5, 2018 · 190 comments
Open

amigaos4 build #21

kas1e opened this issue Nov 5, 2018 · 190 comments

Comments

@kas1e
Copy link

kas1e commented Nov 5, 2018

Hi !
Tried to build SDL2 version for amigaos4 , and tryint to use CMAKE as i am on crosscompiler, so can use that one.

That what i tried:

cd friking-shark-master

mkdir build
cd build
cmake
-DCMAKE_SYSTEM_NAME=Generic
-DCMAKE_SYSTEM_VERSION=1
-DSDL=ON
-DCMAKE_C_COMPILER="/usr/local/amiga/bin/ppc-amigaos-gcc"
-DCMAKE_CXX_COMPILER="/usr/local/amiga/bin/ppc-amigaos-g++"
-DCMAKE_LINKER="/usr/local/amiga/bin/ppc-amigaos-ld"
-DCMAKE_AR="/usr/local/amiga/bin/ppc-amigaos-ar"
-DCMAKE_RANLIB="/usr/local/amiga/bin/ppc-amigaos-ranlib"
-DCMAKE_FIND_ROOT_PATH="/usr/local/amiga/ppc-amigaos/"
-DZLIB_INCLUDE_DIR="/usr/local/amiga/ppc-amigaos/SDK/Local/common/include/"
-DZLIB_LIBRARY="/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/lib/libz.a"
-DPNG_PNG_INCLUDE_DIR="/usr/local/amiga/ppc-amigaos/SDK/Local/common/include/libpng12/"
-DPNG_LIBRARY="/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/lib/libpng12.a"
-DOPENGL_gl_LIBRARY="libgl4es.a"
-DOPENAL_LIBRARY="/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/lib/libopenal.a"
-DOPENAL_INCLUDE_DIR="/usr/local/amiga/ppc-amigaos/SDK/Local/common/include/AL/"
-DTIFF_INCLUDE_DIR="/usr/local/amiga/ppc-amigaos/SDK/Local/common/include/"
-DTIFF_LIBRARY="/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/lib/libtiff.a"
-DJPEG_INCLUDE_DIR="/usr/local/amiga/ppc-amigaos/SDK/Local/common/include/"
-DJPEG_LIBRARY="/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/lib/libjpeg_8b.a"
..

It the says :

CMake Error at CMakeLists.txt:21 (FIND_PACKAGE):
By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "SDL2", but
CMake did not find one.

Could not find a package configuration file provided by "SDL2" with any of
the following names:

SDL2Config.cmake
sdl2-config.cmake

Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
"SDL2_DIR" to a directory containing one of the above files. If "SDL2"
provides a separate development package or SDK, be sure it has been
installed.

-- Configuring incomplete, errors occurred!

I tried to remove from CMakeList.txt : FIND_PACKAGE(SDL2 REQUIRED) (as i will link everything manually at end anyway), so , it then cry about non possibility to build shared versions and will use static instead (that ok), but then at end:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:

XINERAMA_LIBRARY
linked by target "GameGraphics" in directory /d/friking-shark-master
XRANDR_LIBARY
linked by target "GameGraphics" in directory /d/friking-shark-master

-- Configuring incomplete, errors occurred!

I probably can set them to some void nulls , but probably they need to be removed from CMake if "-DSDL=ON" is used ?

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 5, 2018

The FindSDL2.cmake should be provided by the system. I can probably find one if needed, there are many floating around on the net.

For the xinerama and xrandr library stuff, I'll check. There are not needed and it should not require them, so I guess I have some more work to do on the CMake build project...

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 5, 2018

Latest commit should have fixed the XINERAMA and XRANDR issue (not the FindSDL2 issue).

@kas1e
Copy link
Author

kas1e commented Nov 5, 2018

Yeah , xiNERAMA and XRANDR gone.

For FindSDL2 i just commented out at moment in main CmakeFile.txt FIND_PACKAGE(SDL2 REQUIRED) , as in geneal all it will do it probabaly just find the path where includes and link library placed ? If so, that not big deal there imho.

I also have expected warning about :

ADD_LIBRARY called with SHARED option but the target platform does not support dynamic linking. Building a STATIC library instead. This may lead to problems.

But that probably harmless for me, as i of course will use static ones.

Then i type "make" and compilation starts. It compile for me first GameEntityLib.a , then start to compile GameRunTimeLib, and fail on the friking-shark-master/GameRunTimeLib/PlatformDependent.cpp , with the words:

GameRunTimeLib/PlatformDependent.cpp: In function 'unsigned int GetTimeStamp()':
GameRunTimeLib/PlatformDependent.cpp:303: error: aggregate 'timespec ts' has incomplete type and cannot be defined
GameRunTimeLib/PlatformDependent.cpp:304: error: 'CLOCK_MONOTONIC' was not declared in this scope
GameRunTimeLib/PlatformDependent.cpp:304: error: 'clock_gettime' was not declared in this scope
GameRunTimeLib/PlatformDependent.cpp: In function 'bool FindFiles(const char*, EFindFilesMode, std::set<std::basic_string<char, std::char_traits,
std::allocator >, std::less<std::basic_string<char, std::char_traits, std::allocator > >,
std::allocator<std::basic_string<char, std::char_traits, std::allocator > > >*)':

GameRunTimeLib/PlatformDependent.cpp:318: error: 'GLOB_ONLYDIR' was not declared in this scope
GameRunTimeLib/CMakeFiles/GameRunTimeLib.dir/build.make:158: recipe for target 'GameRunTimeLib/CMakeFiles/GameRunTimeLib.dir/PlatformDependent.cpp.obj' failed
make[2]: *** [GameRunTimeLib/CMakeFiles/GameRunTimeLib.dir/PlatformDependent.cpp.obj] Error 1
CMakeFiles/Makefile2:843: recipe for target 'GameRunTimeLib/CMakeFiles/GameRunTimeLib.dir/all' failed
make[1]: *** [GameRunTimeLib/CMakeFiles/GameRunTimeLib.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

Will check now what is do, and how it can be replaced. Also dunno if there is needs for "GameRunTimeLib" if i will build static version ..

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 5, 2018

The clock_gettime(...) & CLOCK_MONOTONIC is probably linux only? You can probably alter the code to use SDL_GetTicks() instead.

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 5, 2018

Ok, I have pushed some changes, with an AMIGAOS4 in the cmake, and alternative code for that function.

@kas1e
Copy link
Author

kas1e commented Nov 5, 2018

First error with CLOCK_MONOTIC was becase of pandora change, there is even "if/else" for old version, so i enable that one for os4.

As for error for "GLOB_ONLYDIR" not being declared :: didn't find it in my GLOB.h at all, so probably too old newlib for me and i currentlyy just "dummied" it from glob.h found in google, like : # define GLOB_ONLYDIR (1 << 13). But that will of course not works as should, but at least object compiles for the moment.

Then all continue to builds without single warning (strange!) and compile all those libs for me:
libGameRunTimeLib.a
libGameGUILib.a
libVectorLib.a
libAirUnitTypes.a
libAnymationSystems.a
libBSPDebugger.a
libBonusTypes.a
libEntityEditor.a
libFormationEditor.a
libGUISystems.a
libGameRunTime.a

And then when start to build GameEngine, fail with words:

make[2]: *** No rule to make target 'libgl4es.a', needed by 'Demo/Bin/Release/GameEngine'. Stop.

Is that one which i provide for cmake , via :

-DOPENGL_gl_LIBRARY="libgl4es.a" \

Maybe that directive is not what build sytem want ..

@kas1e
Copy link
Author

kas1e commented Nov 5, 2018

Ah its already tried to link binary GameEngine ! Strange, it was only 50% complete of all compilation..

So, with that line i almost compile that binary:

ppc-amigaos-g++ -static CMakeFiles/GameEngine.dir/GameEngine/GameEngine.cpp.obj CMakeFiles/GameEngine.dir/GameEngine/StdAfx.cpp.obj -o Demo/Bin/Release/GameEngine GameGUILib/libGameGUILib.a GameRunTimeLib/libGameRunTimeLib.a VectorLib/libVectorLib.a GameEntityLib/libGameEntityLib.a libGameRunTime.a -lpng12 -lopenal libSDL2.a libgl4es.a GameGUILib/libGameGUILib.a GameRunTimeLib/libGameRunTimeLib.a VectorLib/libVectorLib.a -lglob -lpthread -stdc++ -lz

Through have those errors:

SystemModule.cpp:(.text+0x17e4): undefined reference to dlopen' SystemModule.cpp:(.text+0x1928): undefined reference to dlopen'
SystemModule.cpp:(.text+0x1aec): undefined reference to dlerror' SystemModule.cpp:(.text+0x1b40): undefined reference to dlsym'
SystemModule.cpp:(.text+0x1b70): undefined reference to dlsym' SystemModule.cpp:(.text+0x1be0): undefined reference to dlerror'
SystemModule.cpp:(.text+0x1da0): undefined reference to dlclose' libGameRunTime.a(SystemModule.cpp.obj): In function CSystemModule::Destroy()':
SystemModule.cpp:(.text+0x2030): undefined reference to `dlclose'
collect2: ld returned 1 exit status

I anyway build all statically, dunno what it tryes to do, but probabaly i can comment that part out ?

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 5, 2018

Yeah, all those dlopen/dlsym/dlclose are for the dynamic lib system.
dlopen and dlclose can be commented, but for dlsym it's more tricky as you need to get the function pointer.

@kas1e
Copy link
Author

kas1e commented Nov 5, 2018

But probabaly i need it only when i use .so , but while i build everything statically, i can just comment everything related to "dl*" out, and it should have no impacts on ?

Btw, is there few binaries should be? That one which called "GameEngine" compiles on 50% of whole process, so seems there few binaries ?

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 5, 2018

Some of the other .so are dynamic and independant, and are supposed to be loaded at runtime by GameEngine using that SystemModule... That's why they are not linked to GameEngine.

@kas1e
Copy link
Author

kas1e commented Nov 5, 2018

So.. that mean once 50% is done, we have ready GameEngine.exe, and then, another 50% will be .sobjes.
Uhm .. that mean or i should do sobjes as it expected , or , i need to build them statically, link them to the GameEngine.exe , and in GameEngine's code replace all external functions to looks like internal..

@kas1e
Copy link
Author

kas1e commented Nov 5, 2018

So i just comment out at moment all "dlopen/dlclose/dlsym/dlerror" in that systemmodule.cpp (just to deal before with everything else, and to have final binaries, libs, etc).

For that i only change in the build/CMakeFiles/GameEngine.dir/link.txt linking line on my one:
ppc-amigaos-g++ -static CMakeFiles/GameEngine.dir/GameEngine/GameEngine.cpp.obj CMakeFiles/GameEngine.dir/GameEngine/StdAfx.cpp.obj -o Demo/Bin/Release/GameEngine GameGUILib/libGameGUILib.a GameRunTimeLib/libGameRunTimeLib.a VectorLib/libVectorLib.a GameEntityLib/libGameEntityLib.a libGameRunTime.a GameGUILib/libGameGUILib.a GameRunTimeLib/libGameRunTimeLib.a VectorLib/libVectorLib.a -lpng12 -lopenal libSDL2.a libgl4es.a -lglob -lpthread -stdc++ -lz

So it links fine, and continue to compile next stuff, and fail in the GameGraphics/Glee.c , as it has include of gl.h and glx.h , and there is all messes up with errors, because of x11. Probablyy there also needs some SDL2 based changes ?

@kas1e
Copy link
Author

kas1e commented Nov 5, 2018

Fixed GameGraphics/Glee.h by commenting out #include <GL/glx.h>
Also by adding adding that on the line 809:
#elif defined(APPLE) || defined(APPLE_CC) || defined(amigaos4)

and line 16546:
#elif defined(APPLE) || defined(APPLE_CC) || defined(amigaos4)

So, after that have just few errors from GLee.c itself , saying that Display and Dpy undeclared, so at the line 15936 i also doing that:

#elif defined(APPLE) || defined(APPLE_CC) || defined(amigaos4)

Then Glee.cpp compiles.

Then time of OpenGLFont.h, cry about XFontStruct and Display.. and there i think its already need SDL2 changes in those files ..

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 5, 2018

Mmmm, XFontStruct, I'll see what I can do.

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 14, 2018

Ok @kas1e it should be fixed now with latest commit.

@kas1e
Copy link
Author

kas1e commented Nov 21, 2018

So , i was able to test latest revision , and yeah ! Everything builds till 100%.
Through i had to comment out of course at moment all dlopen/dlclose/dlsym/dlerror calls in the GameRunTime/SystemModule.cpp.
Also to GameRunTimeLIB/PlatformDependent.cpp had to add that placeholder:
# define GLOB_ONLYDIR (1 << 13)
(as we don't have it)

And, i also had to comment out include of glu.h , and instead implemnt those fucntions:
gluPerspective, gluPickMatrix, gluBuild2DMipmaps and gluProject/gluUnProject.

First 2 i just copy from mesa code:

void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat znear, GLfloat zfar)
{
GLfloat xmin, xmax, ymin, ymax;

ymax = znear * tan(fovy * 0.008726646);
ymin = -ymax;
xmin = ymin * aspect;
xmax = ymax * aspect;

glFrustum(xmin, xmax, ymin, ymax, znear, zfar);
}

void gluPickMatrix(GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
{
GLfloat m[16];
GLfloat sx, sy;
GLfloat tx, ty;

sx = viewport[2] / width;
sy = viewport[3] / height;
tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width;
ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height;

#define M(row, col) m[col*4+row]
M(0, 0) = sx;
M(0, 1) = 0.0;
M(0, 2) = 0.0;
M(0, 3) = tx;
M(1, 0) = 0.0;
M(1, 1) = sy;
M(1, 2) = 0.0;
M(1, 3) = ty;
M(2, 0) = 0.0;
M(2, 1) = 0.0;
M(2, 2) = 1.0;
M(2, 3) = 0.0;
M(3, 0) = 0.0;
M(3, 1) = 0.0;
M(3, 2) = 0.0;
M(3, 3) = 1.0;
#undef M

glMultMatrixf(m);
}

Third one, in the GameGraphics/OpenGLTexture.cpp:220, i replace like you show in prototype:

#ifdef amigaos4
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, dwColorType==GL_RGBA?4:3,m_dwWidth,m_dwHeight,0, dwColorType,GL_UNSIGNED_BYTE,m_pBuffer);
#else
gluBuild2DMipmaps(GL_TEXTURE_2D,dwColorType==GL_RGBA?4:3,m_dwWidth,m_dwHeight,dwColorType,GL_UNSIGNED_BYTE,m_pBuffer);
#endif

But gluProject/gluUnProject i currently comment out as dunno how to replace them, but that imho at moment not so matter.

So, in end of all, i have in my build directory bunch of .a files (as cmake at begining says me that can't create shared objects, and create static ones already).

So.. I need probably to get rid of systemmonitor.cpp probabaly and somehow made main binary think that all functions should't be taken from external modules, but from internal, and then , link that exe with all the .a files i have.

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 21, 2018

Ok, I'll look at that later, see if I can make a static build of everything...

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 3, 2018

So, I have added a STATIC_BUILD option to the cmake project (as you can see from the commit, it is a big change). I quickly tested and seems to work on my side (just launched the game, I haven't played at all). It should help you get it running on the Amiga...

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 3, 2018

For GLU stuff, I suggest you build the lib. Look here https://github.com/ptitSeb/GLU it should not be too difficult to build as a static lib. gluProject(...) and gluUnProject(...) are matrix stuff and can be implemented (well copy/pasted from GLU itself), but why not using the real thing (open a ticket on my GLU repo if there are any issues).

@kas1e
Copy link
Author

kas1e commented Dec 3, 2018

Awesome !

Yeah, probably i should go for your GLU, as it quite offten happen to need.

But at moment to test friking-shark static build, can comment out those parts as usuall, just to try to deal with static build.

For first, when i run CMAKE, with AMIGAOS4=ON, it still bring some errors like :

CMake Warning (dev) at AirUnitTypes/CMakeLists.txt:21 (ADD_LIBRARY):
ADD_LIBRARY called with SHARED option but the target platform does not
support dynamic linking. Building a STATIC library instead. This may lead
to problems.
Call Stack (most recent call first):
CMakeLists.txt:80 (INCLUDE)
This warning is for project developers. Use -Wno-dev to suppress it.

And so on for all others (as it was before), but i think it is harmless as we know what we do.

Then, i start compile things, and it compiles till 50% , then it want to do Linking CXX executable Demo/Bin/Release/GameEngine , and it still include libGameRunTime.a , and that one scream about dlopen/dlclose/dlsym and co.

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 3, 2018

You need to use also STATIC_BUILD=ON (I haven't forced static build for Amiga for now. I'll do that later proabably).

@kas1e
Copy link
Author

kas1e commented Dec 3, 2018

As yep, just checked at top of Cmakefile before that there is it , and was thinking it enabled for AMIGAOS4 :)

So, trying with STATIC_BUILD=ON : cmake not scream about dynamic, all is fine, compilation going on and on, i only had to comment out GLU parts (for testing now), and all compiles till final 100% and links ! Yeaho !

Now, if i understand things right, there is relevant data files for game:

Capturas
Player
Resources
config.ini
Log.txt
GameEngine

Now when i trying to run it like this, i have:

3/0.Work:friking-shark> GameEngine
LIBGL: Initialising gl4es
LIBGL: v1.1.1 built on Nov 27 2018 21:22:32
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:friking-shark
CGameEngineApp::Run -> Setting root folder to ./../../Resources
CGameEngineApp::Run -> Error setting root folder to ./../../Resources
CGameEngineApp::Run -> Failed to open configuration file Scripts/GameGUI.cfg
LIBGL: OGLES2 Library and Interface closed

Usuall stuff with pathes :) I just tried manually to set in the GameEngine/GameEngine.cpp

#ifdef __amigaos4__
g_sRootFolder = "PROGDIR:Resources/";
#endif

And then that what i have :

3/0.Work:friking-shark> GameEngine
LIBGL: Initialising gl4es
LIBGL: v1.1.1 built on Nov 27 2018 21:22:32
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:friking-shark
CGameEngineApp::Run -> Setting root folder to PROGDIR:Resources/
Init("GameGraphics", piSystem=0x586f24f0, this=0x586f2938)
Init("SoundSystems", piSystem=0x586f24f0, this=0x586f2b20)
Init("GameGUI", piSystem=0x586f24f0, this=0x586f2c00)
Init("GUISystems", piSystem=0x586f24f0, this=0x586f2f38)
Init("GameManagers", piSystem=0x586f24f0, this=0x586f32e8)
CSoundSystemManager::Init -> Sound system initialized using device 'default'
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: Extension GL_EXT_texture_filter_anisotropic detected and used
LIBGL: Max Anisotropic filtering: 16
LIBGL: Hardware vendor is A-EON Technology Ltd. Written by Daniel 'Daytonta675x' MьЯener @ GoldenCode.eu
CSoundType::LoadFromFile -> Failed to load sound ./Sounds/PointCount.ogg.
CSoundType::LoadFromFile -> ./Sounds/PointCount.ogg loaded (0 ms)
CSystemObjectWrapper::Load -> Failed to unserialize System: GameGUI, Class: SoundType, Object:PointCountSound
CSoundType::LoadFromFile -> Failed to load sound ./Sounds/BombCount.ogg.
CSoundType::LoadFromFile -> ./Sounds/BombCount.ogg loaded (0 ms)
CSystemObjectWrapper::Load -> Failed to unserialize System: GameGUI, Class: SoundType, Object:BombCountSound
CSoundType::LoadFromFile -> Failed to load sound ./Sounds/BonusLife.ogg.
CSoundType::LoadFromFile -> ./Sounds/BonusLife.ogg loaded (0 ms)
CSystemObjectWrapper::Load -> Failed to unserialize System: GameGUI, Class: SoundType, Object:LiveSound
CSoundType::LoadFromFile -> Failed to load sound ./Sounds/ButtonClick.ogg.
CSoundType::LoadFromFile -> ./Sounds/ButtonClick.ogg loaded (0 ms)
CSystemObjectWrapper::Load -> Failed to unserialize System: GameGUI, Class: SoundType, Object:ClickSound
CSoundType::LoadFromFile -> Failed to load sound ./Sounds/ButtonHover.ogg.
CSoundType::LoadFromFile -> ./Sounds/ButtonHover.ogg loaded (0 ms)
CSystemObjectWrapper::Load -> Failed to unserialize System: GameGUI, Class: SoundType, Object:HoverSound
CSoundType::LoadFromFile -> Failed to load sound ./Sounds/SmallExplosionWithTail.ogg.
CSoundType::LoadFromFile -> ./Sounds/SmallExplosionWithTail.ogg loaded (0 ms)
CSystemObjectWrapper::Load -> Failed to unserialize System: GameGUI, Class: SoundType, Object:SoundFXTest
CSoundType::LoadFromFile -> Failed to load sound ./Sounds/gameover.ogg.
CSoundType::LoadFromFile -> ./Sounds/gameover.ogg loaded (0 ms)
CSystemObjectWrapper::Load -> Failed to unserialize System: GameGUI, Class: SoundType, Object:MusicTest
COpenGLTexture::LoadFromFile -> Loaded texture GUI/BrownFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/WhiteFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/GreyFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/DarkGreyFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/OrangeRedFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/BlueFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/GreenFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/MainFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/MainDisabledFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/HoverFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/WhiteRedFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/WhiteLightRedFont.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/Level1Icon.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/Level2Icon.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/Level3Icon.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/Level4Icon.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/Level5Icon.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/GUI-Cursor.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/PlayerIcon.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/BombIcon.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/WeaponIcon.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/VolumeBarFull.png (0 ms)
COpenGLTexture::LoadFromFile -> Loaded texture GUI/VolumeBarEmpty.png (0 ms)
CSoundType::LoadFromFile -> Failed to load sound ./Sounds/gameover.ogg.
CSoundType::LoadFromFile -> ./Sounds/gameover.ogg loaded (0 ms)
CSystemObjectWrapper::Load -> Failed to unserialize System: GameGUI, Class: SoundType, Object:Music
CSoundType::LoadFromFile -> Failed to load sound ./Sounds/highscore.ogg.
CSoundType::LoadFromFile -> ./Sounds/highscore.ogg loaded (0 ms)
CSystemObjectWrapper::Load -> Failed to unserialize System: GameGUI, Class: SoundType, Object:Music

So it going quite a lot , show us that in the sound module also need to deal with "./" thing , but then, after that it crashes anyway :(

Crashlog looks like this:

Stack trace:
(0x59140D20) module LIBS:Warp3DNova/W3DN_SI.library at 0x7EFDFAC4 (section 0 @ 0x6AA0)
(0x59140FF0) module LIBS:ogles2.library at 0x7F455F0C (section 0 @ 0xBEE8)
(0x59141070) GameEngine:gl4es_glPushAttrib()+0xe50 (section 1 @ 0xB2C4D0)
(0x591410C0) GameEngine:_ZN13COpenGLRender5ClearERK7CVectord()+0x74 (section 1 @ 0x356224)
(0x59141100) GameEngine:_ZN15CGameWindowBase16OnDrawBackgroundEP14IGenericRender()+0x1bc (section 1 @ 0x9153B8)
(0x59141220) GameEngine:_ZN15CGameGUIManager12RenderWindowEP14IGenericRenderP11IGameWindow9SGameRect()+0x3ec (section 1 @ 0x417E08)
(0x59141430) GameEngine:_ZN15CGameGUIManager12RenderWindowEP14IGenericRenderP11IGameWindow9SGameRect()+0x6e4 (section 1 @ 0x418100)
(0x59141640) GameEngine:_ZN15CGameGUIManager8OnRenderEv()+0x11c (section 1 @ 0x418384)
(0x59141710) GameEngine:_ZN15COpenGLViewport6RenderEv()+0xf0 (section 1 @ 0x3B3F2C)
(0x59141730) GameEngine:_ZN15COpenGLViewport9EnterLoopEv()+0xfc (section 1 @ 0x3B491C)
(0x591417A0) GameEngine:_ZN15CGameGUIManager12EnterGUILoopEv()+0x50 (section 1 @ 0x4173D4)
(0x591417C0) GameEngine:_ZN14CGameEngineApp3RunEv()+0x53c (section 1 @ 0x5920)
(0x59141B60) GameEngine:main()+0x2f0 (section 1 @ 0x67DC)
(0x59141D10) native kernel module newlib.library.kmod+0x00001e7c
(0x59141D70) native kernel module newlib.library.kmod+0x00002d6c
(0x59141F20) native kernel module newlib.library.kmod+0x0000305c
(0x59141F50) GameEngine:_start()+0x170 (section 1 @ 0x1920)
(0x59141F90) native kernel module dos.library.kmod+0x00026724
(0x59141FC0) native kernel module kernel+0x0006b268
(0x59141FD0) native kernel module kernel+0x0006b2b0

I.e. it crashes in warp3dlibrary in end, but is that one guilty there ? (probabaly yes, as usuall).

But anyway we pretty far already , cool :) I even didn't expect it will start loading but will crashes instead right at begining :)

@kas1e
Copy link
Author

kas1e commented Dec 3, 2018

It even maybe crashes because i comment out some glu parts ..

Oh, after ignoring of that crash (it is not fatal one, can be ignored), game actually starts, i can see menu. Can choice start game, and have 5 levels to choice, but i can't choice any of them, does not matter how hard i press by mouse button on them.

But firstly will try to deal with sounds pathes

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 3, 2018

You cannot choose menu item because you commented ou gluProject(...) and gluUnProject(...)... A proprer version of GLU would solve all that...

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 3, 2018

The crash you have on gl4es_glPushAttrib(...) is a bit strange. I'll need to investigate.

@kas1e
Copy link
Author

kas1e commented Dec 3, 2018

It seems i also need to patch data script files : they use ./ in configs, so even after i fix all pathes in the code itself, it still fail to load, so i had to delete all "./" in the most of Resource/Scripts/*.cfg files. After that sound loads , but , it also have some distortion, so i had a look if game use ov_read() and yep, its here in the SoundType.cpp.

But probabaly we should not use in those cases #ifdef __amigaos4__, but #ifdef __BIG_ENDIAN__, as that one will works everywhere, and not only on amigaos4 (that __BIG_ENDIAN__ are gcc default thing).

@kas1e
Copy link
Author

kas1e commented Dec 3, 2018

I mean:

#ifdef USE_TREMOR
nDecodedBytes=ov_read(&oggFile, temp, OGG_PACKET_SIZE, &bitStream);
#else
#ifdef __BIG_ENDIAN__
nDecodedBytes=ov_read(&oggFile, temp, OGG_PACKET_SIZE, 1, 2, 1, &bitStream);
#else
nDecodedBytes=ov_read(&oggFile, temp, OGG_PACKET_SIZE, 0, 2, 1, &bitStream);
#endif
#endif

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 3, 2018

Ah yes, ok, I'll do that tomorrow.

@kas1e
Copy link
Author

kas1e commented Dec 3, 2018

As for your libglu : maybe i didn't got something, but i just download it, configure; make , and everything done. Then i grab some test case from net which use sdl2 + gl + glu , and compile it via sdl2+gl4es+that_glu , and all works.

Is it expected to be like that, without needs for anything else ?

Anyway, i then put back all commented glu parts from the friking shark, and build it with your glu library, and sadly i still can't press on the levels. I mean sound is there , i move mouse over it, but click doing nothing..

But i also see in the console output, that one shader fail to compile because of nova. So maybe that can be issue ?

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 3, 2018

So GLU built without issue? Good (and yeah, nothing more, build it, link it and that it).

Now, why would the mouse selection wont work? I have to analyse how the it work, strange, but I don't think the shader issue can be the reason for that.

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 20, 2018

Ok, so I fixed the issue. But it was bigger than what I expected. In fact, the Context was not destroyed before (that's why the memory leaks were always there). Because of a typo. That typo made the DestroyState function doing nothing when some optimisation level was present, and crashing with no optim...

So all is fixed, and GLState are cleaned from memory now.

I hope nothing is broken, in case some game/aps do some GL Cleaning AFTER destroying the GL Context (friking-shark was doing that for textures, so I already added a failsafe there).

@kas1e
Copy link
Author

kas1e commented Dec 20, 2018

Cool ! I will check it with Barony, Prototype and FrickingShark now.

@kas1e
Copy link
Author

kas1e commented Dec 20, 2018

Just to be sure: its is probabaly can't be related to any other issues , only on "free on exit" ones ?

@kas1e
Copy link
Author

kas1e commented Dec 20, 2018

Failed to build src/glx/glx.c:
/src/glx/glx.h:145:9: error: unknown type name ‘XID’
typedef XID GLXDrawable;

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 20, 2018

:( of course. I'll fix that.

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 20, 2018

Should be fixed now.

@kas1e
Copy link
Author

kas1e commented Dec 20, 2018

Seems still nope, probabaly on line 144 , of glx.h , should be #ifdef NOX11, not ifNdef (without N)
Once i change it , it compiles, through give new warning in lookup.c:
lookup.c:50:7: note: aliased declaration here
void *gl4es_glXGetProcAddress(const char *name) {

@kas1e
Copy link
Author

kas1e commented Dec 20, 2018

While error in glx.h with N is for sure there , that warning maybe was there even before. There is full output about that warning:

/amiga/gl4es-master-1771/src/glx/lookup.c:878:6: warning: ‘aglGetProcAddress’ alias between functions of incompatible types ‘void(const char *)’ and ‘void *(const char )’ [-Wattribute-alias]
void aglGetProcAddress(const char
name) AliasExport("gl4es_glXGetProcAddress");
^~~~~~~~~~~~~~~~~
/amiga/gl4es-master-1771/src/glx/lookup.c:50:7: note: aliased declaration here
void *gl4es_glXGetProcAddress(const char *name) {
^~~~~~~~~~~~~~~~~~~~~~~

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 20, 2018

I fixed the mistake, and the warning.

@kas1e
Copy link
Author

kas1e commented Dec 20, 2018

Aha ok
So, at least fricking shark for sure didn't crashes on exit now , not when i build with -DCMAKE_BUILD_TYPE=Release (so -O3), not when i build without build_type (so no optimisation).

Will check now prototytpe, barony and q3 just to see that all is ok and the same as before

@kas1e
Copy link
Author

kas1e commented Dec 20, 2018

And yep, latest commit make build of everything be warning free and 100% compiles out of box :) Cool !

@kas1e
Copy link
Author

kas1e commented Dec 20, 2018

Seems something changes with context still.

Now, when i trying to change screenmodes (which mean delete and create of context), be it Q3, or Barony, i have a crash in the glClear call, which i have inside of the OS4_SDL_CreateContext() function, which i call right after:

data->glContext = aglCreateContext2(&errCode,create_context_taglist);

And then going:

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

aglMakeCurrent(data->glContext);
glViewport(0, 0, width, height);

And so glClear crashes.

But, it crashes only when it delete and then create context, at first run it didn't crash.

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 20, 2018

You need to call aglMakeCurrent(...) before any call to gl function, like glClear(...).
So it should be:

aglMakeCurrent(data->glContext);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glViewport(0, 0, width, height);

@kas1e
Copy link
Author

kas1e commented Dec 20, 2018

Aha will check now.

But as it works before like this, it mean context wasn't deleted indeed !

@kas1e
Copy link
Author

kas1e commented Dec 20, 2018

Yeah, that way it works!
Barony works for sure too. Q3 works as before too (with same oversized window issue), and probabaly Prototype will works fine too. Phew ! :)

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 20, 2018

Ok Good. Did you notice less memory/ressources leak?

@kas1e
Copy link
Author

kas1e commented Dec 21, 2018

For sure there no gfx leaks (but it was like this once we deal with agldestroycontext() inside of sdl2's OS4_GL_DeleteContext() ).

Didn't checked ram leaks, but it for sure not worse visually.

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 21, 2018

If I remember correctly, the leaks were with Barony, right?

@kas1e
Copy link
Author

kas1e commented Dec 21, 2018

Not only, with prototype as well. But now all good.

I think we need to release fricking shark as it too, and when any from list (f4 crash, real shaders will works, gl4es will have precompiled shaders, gl4es will have support for texture shadows), then we can made an update. I will try to desribe those pauses at best, so maybe all will be fine.

Btw, is real shaders from games which have them, transfered tranparently via gl4es as it, or they recompiles too ? What i mean is if real shader have usage of arrays, then after it go through gl4es it still have arrays ?

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 21, 2018

gl4es transform the shaders, always. It will try to remove arrays, but not too hard. You can try with "LIBGL_NOTEXARRAY=1" to force gl4es to try using less texture array, but it may not work..

@kas1e
Copy link
Author

kas1e commented Dec 21, 2018

Aha will check, thanks. Because error we have with real shaders because of bug in arrays support, so if gl4es can generate from real fricking sharks which has arrays shaders without arrays : it may do the trick

@kas1e
Copy link
Author

kas1e commented Dec 22, 2018

By "it may not work" you mean generated shader withoud arrays will works wrong, or not works at all ?

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 22, 2018

It may not work at all, with an error during link of the shaders. But you can try, you will have the awnser quickly.

@kas1e
Copy link
Author

kas1e commented Dec 22, 2018

Yeah, tried alraeady and it fail, just asking to be sure :)

It fail with words:

INTERNAL ERROR: Source parameter is missing it's CG Object:
154: OpVariable: SampledImage(Image(Float))*: Texture0: storage class: UniformConstant Decorators: RelaxedPrecision, DescriptorSet(0)`

I can check if it gl4es generate wrong shader (via glslangvalidator) , or w3dnova fail again, if there is needs (i mean if you want to be sure that LIBGL_NOTEXARRAY works there)

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 22, 2018

Well, LIBGL_NOTEXARRAY is a hack. It would be nice if it work, but there are certain cases were it will be to difficult to fix.

@kas1e
Copy link
Author

kas1e commented Dec 30, 2018

Btw, one of testers mention there is no joypad support (while in prototype support is there). Is it matter of just adding sone flag to SDL, or some new code has to be added ?

@ptitSeb
Copy link
Owner

ptitSeb commented Dec 30, 2018

There is no joystick code currently in friking shark. But using the SDL2 Gamecontroler interface, I might add something in an not to complicated way.

Can you try the joystick code in HydraCastleLabyrinth: build an SDL2 version, I plan to reuse that Gamecontroler code I wrote for this game.

@kas1e
Copy link
Author

kas1e commented Dec 30, 2018

Cool , ok, will try to build HydraCastleLabyrinth firstly (and if you doesnt mind, as usuall will create a topic in that repo for aos4 build if it will be not straight-forward build ?)

@kas1e
Copy link
Author

kas1e commented Jan 4, 2019

Btw, you maybe in interst, one of Poland's amiga website made an article about frickingshark and prototype releases , if you in interest to read english version there is:

http://translate.google.com/translate?hl=&sl=pl&tl=en&u=http%3A%2F%2Fwww.amigaone.pl%2F%3Fp%3D2731

Sadly author don't call the names , but concetrate instead on the games only, but still, interesting to read :)

@ptitSeb
Copy link
Owner

ptitSeb commented Jan 4, 2019

Ah, that look like a nice article. I'll read that, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants