ptitSeb / friking-shark

Port of Friking Shark (remake of Flying Shark) on the OpenPandora, Odroid and most Linux. Also with AmigaOS4 support. Status: Working (using gl4es).
https://boards.openpandora.org/topic/5600375-friking-shark/
Other
11 stars 0 forks source link

amigaos4 build #21

Open kas1e opened 5 years ago

kas1e commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

kas1e commented 5 years ago

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 commented 5 years ago

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

ptitSeb commented 5 years ago

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

kas1e commented 5 years ago

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 commented 5 years ago

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 todlopen' SystemModule.cpp:(.text+0x1aec): undefined reference to dlerror' SystemModule.cpp:(.text+0x1b40): undefined reference todlsym' SystemModule.cpp:(.text+0x1b70): undefined reference to dlsym' SystemModule.cpp:(.text+0x1be0): undefined reference todlerror' SystemModule.cpp:(.text+0x1da0): undefined reference to dlclose' libGameRunTime.a(SystemModule.cpp.obj): In functionCSystemModule::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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

ptitSeb commented 5 years ago

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

kas1e commented 5 years ago

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 commented 5 years ago

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

ptitSeb commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

ptitSeb commented 5 years ago

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

kas1e commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

kas1e commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

For the non-responsive GUI, I think most of the code is here: GameGUI/GameGUIButton.cpp maybe put some printf in void CGameGUIButton::OnMouseMove(double x,double y) to see what is happening? (do also OnMouseDown and OnMouseUp)

kas1e commented 5 years ago

I can see also that not all models/textures still loads for me, still can see a bit of "./" in log. Dunno if that can cause it too .. But probabaly tomorrow can deal with all the patches, and then ..

What worry me is that gl4es_pushattrib , that imho 99% ogles2/nova issue, but that need to pinpoint what problem is ..

ptitSeb commented 5 years ago

I have pushed some changes for Amiga build, with some code to workaround the path issue (hopefully).

In the level selection menu, you have to select the level then press "Go!" in the lower right side of the screen.

I have a segfault at this point (when level start), not sure yet what the cause really is, I'm debugging.

kas1e commented 5 years ago

In the level selection menu, you have to select the level then press "Go!" in the lower right side of the screen.

Hm ! For me it didn't looks like this. That what i have when running game:

http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik1.jpg

And that how looks like for me level loading:

http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik2.jpg

Looks like it all wrong ? Also cursor didn't looks as correct one imho ? And strange it go to 640x480 by default..

I probabaly need to try to delete everything, and rebuild with latest commits you do today.

kas1e commented 5 years ago

Rebuild all from scratch with latest commit : pathes seems ok, but all the same : same crash in gl4es_pushAttribs, and same look of menu.. Also seems less stuff loads at begining and seems it didn't load shaders (as have no error about), but that probably because of config file which didn't find, as for my previous build i did fix it as well, but that is better at moment anyway : less for first tests.

kas1e commented 5 years ago

Oh, and i found some video on youtube of how menu looks like : that for sure not like it for me :) I didn't have background. I also didn't have words "scrores,options,exit". And that all looks like this probabaly because it create 640x480 screen for me, while should create another one ?

btw, is it possible to run it in window mode ?

ptitSeb commented 5 years ago

Maybe 640x480 is bit small. Change the resolution and Fullscreen/not fullscreen by editing Resources/GameGUI.cfg

ptitSeb commented 5 years ago

Also, I have just pushed more Amiga path fixes. Config, Shaders and models should now alll read correctly.

kas1e commented 5 years ago

Last commit probably didnt commits (668 last one, 5 hours old)

ptitSeb commented 5 years ago

Ah yes, sorry. Should be ok now.

kas1e commented 5 years ago

Change the resolution and Fullscreen/not fullscreen by editing Resources/GameGUI.cfg

Probabaly you mean Resources/Scripts/GameGUI.cfg ? There if i change fullscreen from 1 to 0, then on running window even didn't creates at all. In console i can see that all start loads , etc, but no window created.

Btw, did you just have one single directory Resources for data files ? I mean do you create another ones like Player, Captures, etc ? There is also some config.ini file in the repo, did you use it somehow ?

Ah yes, sorry. Should be ok now.

Yep, got them, rebuild everything from scratch, and now more stuff loads , include textures, shaders , etc. But looks of menu and co still the same : no background, 640x480, fullscreen only.

Then , if i change in the Resources/Scripts/GameGUI.cfg to have fullscreen with 1024x768, then at least menu fits in, and start to look like this: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik3.jpg

And level choice too: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik4.jpg

But still wrong : no background, and there should be more free area between word at top and at end (at least on youtube video it like this). Probabaly resolution should be even bigger. But that strange, should't it all be "auto-scaled" to fits in any resolution ?

In the level choice i can choice level "1", and press "go", and it show me just gray screen and nothing happens :)

ptitSeb commented 5 years ago

All menu are on screen now.

Still, it's strange that non-fullscreen doesn't work. Maybe I made some mistake in the SDL2 window creation code.

Now, about the ressources not loading. Do you see any error? Any hint of something not loading properly?

kas1e commented 5 years ago

All menu are on screen now.

Yeah, but there should be some empty space bettwen top and bottom entries. When i create 1920x1080 fullscreen only then everything fits as on youtube video. Is autoscalling work originally in game ? I mean, is it our SDL2 changes which didnt allow it, or in game itself everything done for 1920x1080 ?

Still, it's strange that non-fullscreen doesn't work. Maybe I made some mistake in the SDL2 window creation code.

I even din't have any error about, its like creates and didn't shown, or even didn't come to that part..

Now, about the ressources not loading. Do you see any error? Any hint of something not loading properly?

From log everything looks like loads fine, there is current output when running in fullscreen:

http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik_output.txt

What i have its fresh rebuild from scratch of latest repo, + in all the data files in resoruce directory i remove "./" before all the data files names too.

kas1e commented 5 years ago

Probably no backgorund thing can easly be cause by the crash we have in gl4es_pushattrib. Crash can be skipped, but it cause lots of bad memory accesses later, so can be anything weird after.

kas1e commented 5 years ago

Btw, when i build OpenGLViewPort.cpp, i have warning from gcc:

OpenGLViewport.cpp: In member function ‘bool COpenGLViewport::WaitForSDLEvent(int)’: OpenGLViewport.cpp:1710:1: warning: no return statement in function returning non-void [-Wreturn-type]

Dunno if it related to anything ..

Also i tried to add printfs to the COpenGLViewport::CreateWindowed , and when i set fullscreen=0 in the resources/scripts/gamegui.cfg i have come to that function for sure, as well as i have printf right before m_pWindow = SDL_CreateWindow("Friking Shark", x, y, w, h, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL); string.

Then i printf x,y,w,h , and it shown me some crazy numbers (i prinfs then just with %d), like this:

printf("ok, create SDL_Window!\n"); printf("x = %d\n",x); printf("y = %d\n",y); printf("w = %d\n",w); printf("h = %d\n",h);
m_pWindow = SDL_CreateWindow("Friking Shark", x, y, w, h, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL);

And have in return:

x = -2147483648 y = -2147483648 w = -2147483648 h = -2147483648

kas1e commented 5 years ago

Rigth , its something with x,y,w,h : when i set there just cardcoded 0,0,640,480 window creates.

kas1e commented 5 years ago

Maybe because its:

CreateWindowed(unsigned x, unsigned y, unsigned w, unsigned h)

But need to be something like:

CreateWindowed(unsigned int x, unsigned int y, unsigned int w, unsigned int h)

?

ptitSeb commented 5 years ago

For the CreateWindowed, maybe.. I'll check that on my side.

Now, the crash with pushattribute, can you uncomment the line 6 of src/gl/stack.cof gl4es, to see what mask is? That will help a bit to narrow down the issue.

ptitSeb commented 5 years ago

Ok, Fullscreen/Windowed should be fixed now, I've just pushed a fix.

kas1e commented 5 years ago

Now, the crash with pushattribute, can you uncomment the line 6 of src/gl/stack.cof gl4es, to see what mask is? That will help a bit to narrow down the issue.

Sure, there is return: glPushAttrib(0xFFFFF) , and then crash