Need some help to finalize AmigaOS4 port of EGOBOO

Help regarding development/scripting, troubleshooting or just general gameplay -- anything that hasn't already been answered in the Wiki or pinned FAQs.

Moderator: Developers

kas1e
Acid Blob (New member)
Acid Blob (New member)
Posts: 7
Joined: Thu Aug 26, 2010 3:27 pm

Need some help to finalize AmigaOS4 port of EGOBOO

Post by kas1e »

Hi all.

I start to work on a port of EGOBOO to AmigaOS4, check the initall screenshots here:

ImageImage

But it builds with some ugly hacks, and for now it not working in general (just few scenes in menu and menu itself).

The problem for now, its because after i build, and trying to run a game, i have in the debug log:
Bad font size! 0,0 !
Its happenes in the font_bmp.c, on that line:
// Get the size of the bitmap
xsize = oglx_texture_GetImageWidth( TxTexture_get_ptr(( TX_REF )TX_FONT ) );
ysize = oglx_texture_GetImageHeight( TxTexture_get_ptr(( TX_REF )TX_FONT ) );
if ( xsize == 0 || ysize == 0 )
{
log_error( "Bad font size! (%i, %i)\n", xsize, ysize );
}
So, it give me that my size of bitmap are 0x0, but dunno why. So, nextly i just for testing purposes set manually xsize and ysize to 256, and then game builds, runs, i can see that menus (which i show on screenshots), but over that i have many errors/memory leaks and alt in our opengl library (what happenes imho because of that changes).

I use linux source for port, and i also changed in the game/platform/file_linux.c, all the /usr blabla stuff to PROGDIR: (which on aos4 mean "current directory from which you run a programm").

If some of authors of that nasty game can help me to finalize the port, will be very good.

Thanks in advance.
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Post by Zefz »

Seems it cannot load font.bmp correctly?
kas1e
Acid Blob (New member)
Acid Blob (New member)
Posts: 7
Joined: Thu Aug 26, 2010 3:27 pm

Post by kas1e »

@Zefz
Rigth before that fucntions, in code i see:
font_bmp_init();
if ( INVALID_TX_TEXTURE == TxTexture_load_one_vfs( szBitmap, ( TX_REF )TX_FONT, TRANSCOLOR ) )
{
log_error( "load_font() - Cannot load file! (\"%s\")\n", szBitmap );
}
That mean that file are founds and loads looks like (in other case i should have error then) ?
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Post by Zefz »

Check the code in load_one_vfs to see if it is really loaded then?
bgbirdsey
{]-[0{0|307 (Developer)
{]-[0{0|307 (Developer)
Posts: 1864
Joined: Wed Jul 23, 2008 4:22 am
Location: Minnesota, USA

Post by bgbirdsey »

If you could rename your os file(s) file_amiga, and sys_amiga, we would love to include them with the distribution!

Plus, if you find any other amiga-incompatible code, let us know.

-------------------

Well, we can tell that it is loading the bitmaps in general, but I can't be sure which ones are bitmaps and which ones are pngs, etc.

It could be that the code to "upload" the .bmp files into your OpenGL memory is not working properly due to an amiga-specific problem.

If you want to try a hack, you disable the drawing of the bitmapped font by:
  • disable or comment out font_bmp_load_vfs()
  • disabling draw_one_font() by putting a "return;" right at the beginning of the procedure
  • disable font_bmp_length_of_word() in a similar way using "return 0;"
That should remove the dependency, and allow you to run the game.

If there are objects with skins that are completely garbled, then there is a generic problem with loading bitmaps.
kas1e
Acid Blob (New member)
Acid Blob (New member)
Posts: 7
Joined: Thu Aug 26, 2010 3:27 pm

Post by kas1e »

@bgbirdsey

Thanks a lot for detailed help !

I tryed to disable all that fucntions (just to be sure), and, still have those errors (so, its about all that loading in general as you say).

I also make a screenshot of first run, that looks like this (press here for screenshot).

Also when i make it works, i mess a bit with all that data paths. For example, by default data files in basicdat directory or kind (but in code there is always mp_data), so, i change that directory on mp_data. The same i do for modules (i change them to mp_modules).

+ i do many changes related to conver unix patches to amiga paches (i just remove everythere all that /usr blabla, and put PROGDIR:), so i should found all the files in the current directory. But after runnin, game ask me for mounting /PROGDIR: (with first slash), what say to me, that those patches not only in the game/platform/file_linux.c ?

I also uploaded my file_linux.c here. Maybe you can found where i suck with that (i also redifine PREFIX in the file itself, on PREFIX "PROGDIR:" (just for easy purposes, for doing plain "make" without any params).

Thanks a lot for help already.

EDIT: I tryed to run game some more times, and one of time, for first run, it give me that looks (screenshot). When i press on any option, then back to main screen, i have normal menu (as i shown on very first screenshots). That mean that images are in memory, but something going wrong.

PS. My machine have PPC cpu, so BIG ENDIAN (dunno will it make sense here or not). I will try to build egoboo with debug information enabled, and trace where is problems happenes.
User avatar
penguinflyer5234
Sheep (Developer)
Sheep (Developer)
Posts: 3025
Joined: Wed Jul 23, 2008 1:39 am
Location: Best Southwest

Post by penguinflyer5234 »

It looks like there are some OpenGL issues... You might have to tweak around with setup.txt. What does log.txt (.egoboo-2.x/debug/log.txt) say about OpenGL?
...
bgbirdsey
{]-[0{0|307 (Developer)
{]-[0{0|307 (Developer)
Posts: 1864
Joined: Wed Jul 23, 2008 4:22 am
Location: Minnesota, USA

Post by bgbirdsey »

Since the opening graphics seem to have worked before, it seems that some new OpenGL function call is corrupting something.

There are definitely some memory issues with OpenGL. The fact that 2 images are using the graphics for the "Version 2.8" means that they are defaulting to the same memory or the same texture name. This can be almost murder to debug. There is a macro switch you can turn on to error trap almost every single OpenGL command, called USE_GL_DEBUG in ogl_debug.h. This will pick up most OpenGL errors, but not all.

If there was an endian problem, you would expect a lot of color warping (i.e. red->blue or something), so those original pictures seem to indicate that the endian thing is not a problem.
kas1e
Acid Blob (New member)
Acid Blob (New member)
Posts: 7
Joined: Thu Aug 26, 2010 3:27 pm

Post by kas1e »

To sorted out all possible problems, i just rebuild everything from scrath, and there is what happenes step by step:

That what i change:
a) . change platform/file_linux.c on my which i upload in previous post
b). add define USE_GL_DEBUG 1 to extension/ogl_debug.h
c). comment out few opengl strings in the ogl_debug (because our opengl do not have those fucntions):
glGetTexGenfv
glGetTexGeniv
glGetPointerv
glGetTexEnvfv

As i see, these fucntions uses only for GL_DEBUG , so, that should not make any problems for game itself (imho)

So, after that i trying to compile the game, and on compiling stage i have many warnings like this:
profile.inl:51: warning: comparison is always true due to limited range of data type
profile.inl:54: warning: comparison is always true due to limited range of data type
profile.inl: In function 'pro_get_imad':
profile.inl:62: warning: comparison is always true due to limited range of data type
profile.inl:65: warning: comparison is always true due to limited range of data type
profile.inl: In function 'pro_get_ieve':
profile.inl:73: warning: comparison is always true due to limited range of data type
profile.inl:76: warning: comparison is always true due to limited range of data type
As well as in particle.inl, char.inl , game.c , graphics_mad.c , graphics_prt.c and alt.
Dunno can it be problematic or not, but just to be sure , i write about it here too.

Anyway, it compiles, and then on running stage i have:
Initializing filesystem services...
Game directories are:
Binaries: PROGDIR:
Data: PROGDIR:
User Data: PROGDIR:.egoboo-2.x
Config Files: PROGDIR:
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
Checking Debug/Log.txt say that game not found "controls.txt", so i go to game/egoboo.c and add
before every controls.txt a progdir:, so it looks like ("PROGDIR:controls.txt");

Rebuild the game, run, and in console have many , very many strings:
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
...and so on..
And at the end:
glGenTextures ("font_ttf.c" - 113)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/SDL_GL_extensions.c" - 411)- invalid operation
Then game exit, and in debug/log.txt i have words:
FATAL ERROR: Bad font size! (0,0)
If i do that hack with "return;", from font fucntions, then it continue to runs, then many errors, bugs, and such screenshots as i show.

Full debug/log.txt looks like this:
Starting Egoboo 2.8.0 ...
INFO: PhysFS file system version 1.1.1 has been initialized...
INFO: Initializing Linux file system...
INFO: Initializing clock services...
INFO: Loaded the default setup file "setup.txt".
INFO: Initializing SDL version 1.2.13... Success!
INFO: Intializing SDL Timing Services... Success!
INFO: Intializing SDL Event Threading... Success!
INFO: Intializing SDL Joystick... Success!
INFO: Intializing SDL Video... Success!
INFO: Opening SDL Video Mode...

==============================================================
SDL set video mode to the current parameters

SDL window parameters
width == 800, height == 600, depth == 24

SDL flags
windowed
SDL software surface
SDL single buffer
OpenGL support
OpenGL-compatible blitting

SDL_GL_Attribtes
SDL_GL_RED_SIZE == 8
SDL_GL_GREEN_SIZE == 8
SDL_GL_BLUE_SIZE == 8
SDL_GL_ALPHA_SIZE == 0
SDL_GL_BUFFER_SIZE == 24
SDL_GL_DEPTH_SIZE == 32
SDL_GL_DOUBLEBUFFER == 1
SDL_GL_STENCIL_SIZE == 0
SDL_GL_ACCUM_RED_SIZE == 0
SDL_GL_ACCUM_GREEN_SIZE == 0
SDL_GL_ACCUM_BLUE_SIZE == 0
SDL_GL_ACCUM_ALPHA_SIZE == 0
SDL_GL_STEREO == 0
SDL_GL_MULTISAMPLEBUFFERS == 0
SDL_GL_MULTISAMPLESAMPLES == 0
SDL_GL_ACCELERATED_VISUAL == 0
SDL_GL_SWAP_CONTROL == 0

SDL using video driver - OS4
==============================================================

OpenGL state parameters
gl_version == 1.3
gl_vendor == The MiniGL Team
gl_renderer == MiniGL/Warp3D ATI Radeon (radeon r200)
gl_extensions == GL_MGL_packed_pixels GL_EXT_packed_pixels GL_EXT_bgra GL_EXT_color_table GL_EXT_vertex_array GL_NV_texgen_reflection GL_ARB_multitexture GL_EXT_compiled_vertex_arrays GL_EXT_draw_range_elements GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_add GL_EXT_texture_env_add
glu_version == (null)
glu_extensions == (null)

GL_MAX_MODELVIEW_STACK_DEPTH == 0
GL_MAX_PROJECTION_STACK_DEPTH == 0
GL_MAX_TEXTURE_STACK_DEPTH == 0
GL_MAX_NAME_STACK_DEPTH == 40
GL_MAX_ATTRIB_STACK_DEPTH == 0
GL_MAX_CLIENT_ATTRIB_STACK_DEPTH == 0

GL_SUBPIXEL_BITS == 0
GL_POINT_SIZE_RANGE == 0.000000 - 8.000000
GL_POINT_SIZE_GRANULARITY == 0.000000
GL_LINE_WIDTH_RANGE == 0.000000 - 0.000000
GL_LINE_WIDTH_GRANULARITY == 0.000000

GL_MAX_VIEWPORT_DIMS == 0, 0
GL_AUX_BUFFERS == 0
GL_RGBA_MODE == FALSE
GL_INDEX_MODE == FALSE
GL_DOUBLEBUFFER == FALSE
GL_STEREO == FALSE
GL_RED_BITS == 0
GL_GREEN_BITS == 0
GL_BLUE_BITS == 0
GL_ALPHA_BITS == 0
GL_INDEX_BITS == 0
GL_DEPTH_BITS == 0
GL_STENCIL_BITS == 0
GL_ACCUM_RED_BITS == 0
GL_ACCUM_GREEN_BITS == 0
GL_ACCUM_BLUE_BITS == 0
GL_ACCUM_ALPHA_BITS == 0

GL_MAX_LIGHTS == 8
GL_MAX_CLIP_PLANES == 0
GL_MAX_TEXTURE_SIZE == 2048

GL_MAX_PIXEL_MAP_TABLE == 0
GL_MAX_LIST_NESTING == 64
GL_MAX_EVAL_ORDER == 0

==============================================================
Success!
INFO: Initializing the SDL_ttf font handler version 2.0.9... Success!
INFO: net_initialize: Networking not enabled.
INFO: Initializing SDL_Image version 1.2.6... Success!
INFO: Intializing SDL Audio... Success!
INFO: Initializing SDL_mixer audio services version 1.2.11... Success!
FATAL ERROR: Bad font size! (0, 0)
Have anyone any ideas ?:)
User avatar
penguinflyer5234
Sheep (Developer)
Sheep (Developer)
Posts: 3025
Joined: Wed Jul 23, 2008 1:39 am
Location: Best Southwest

Post by penguinflyer5234 »

uhhh those GL_* don't look right at all... does MiniGL use OpenGL ES? I don't think we support OpenGL ES...
...
bgbirdsey
{]-[0{0|307 (Developer)
{]-[0{0|307 (Developer)
Posts: 1864
Joined: Wed Jul 23, 2008 4:22 am
Location: Minnesota, USA

Post by bgbirdsey »

First, you need PhysFS > 2.0 or there is a bug that will cause the virtual directory system to be unable to be changed once loaded up (i.e. you can't get it to load another module properly).

Then, you need to track down those gl errors. I think they are there because it is not loading the font bitmap properly. If you disable the function that displays those fonts, then they may go away.
kas1e
Acid Blob (New member)
Acid Blob (New member)
Posts: 7
Joined: Thu Aug 26, 2010 3:27 pm

Post by kas1e »

@penguinflyer5234
Not sure that i understand what you mean about "those GL_* not looks right".Do you mean that errors ? Related to OpenGL ES, dunno what is that, but i know that our MiniGL its just almost all usable fucntions from 1.3 opengl.

@bgbirdsey
First, you need PhysFS > 2.0 or there is a bug that will cause the virtual directory system to be unable to be changed once loaded up (i.e. you can't get it to load another module properly).
That only about loading of game modules ? I mean menu and alt should works fine even with 1.1 version of PhysFS ? (if so, then i should for first fix all that heavy problems, and then port new version of PhyFs).
Then, you need to track down those gl errors. I think they are there because it is not loading the font bitmap properly. If you disable the function that displays those fonts, then they may go away.
Can it be that these errors happenes because i just comment out those fucntions which we not have in our opengl ? I.e. maybe it uses not only for debug printf-information , but also maybe game code itself refer to it somethere ? (and because of it some worng pointer => crashes and errors) ?

I also tryed to disable those fucntions by "return" at begining:

font_bmp.c / font_bmp_load_vfs();
font_bmp.c / font_bmp_length_of_word();
graphics.c / draw_one_font();

As you point before, and then, game start , but in console its a bit different for now:
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("font_ttf.c" - 117)- invalid operation
glGenTextures ("font_ttf.c" - 117)- invalid operation
glGenTextures ("font_ttf.c" - 117)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/SDL_GL_extensions.c" - 411)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/SDL_GL_extensions.c" - 411)- invalid operation
glGenTextures ("extensions/SDL_GL_extensions.c" - 411)- invalid operation
glGenTextures ("extensions/SDL_GL_extensions.c" - 411)- invalid operation
glGenTextures ("extensions/SDL_GL_extensions.c" - 411)- invalid operation
Then crash, but i see game is starts, music plays, menu works, and data are discorted in some place.

Maybe it loading of fonts in general at all ? (bmp + ttf) ? Can you please say what functions i should "return" for save-disabling of ttf font loading ? I trying for now to disable those:

fnt_font.c / fnt_loadFont();
fnt_font.c / fnt_print_raw();
fnt_font.c / fnt_vprintf();
fnt_font.c / fnt_drawText_raw();
fnt_font.c / fnt_drawText();
fnt_font.c / fnt_getTextSize();
fnt_font.c / fnt_drawTextBox();
fnt_font.c / fnt_getTextBoxSize();

In other words all functions in the fnt_font.c, expect fnt_init(); and i have programm start/exit, and in log at end:
FATAL ERROR: Could not load the menu font! ("mp_data/Negatori.ttf")
INFO: memory_cleanUp() - Attempting to clean up loaded things in memory... INFO: Resetting module data
And in console (before exit) as usual many strings of that kind:
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
glGenTextures ("extensions/ogl_texture.c" - 141)- invalid operation
Imho, that say that is not related to fonts , but to any texture at all ?

Also, maybe that will help for us: i see in code some __UNIX__ ifdefs, but we (on aos4) have __amigaos4__ define, so maybe in some places of code its necessary to change ?

Thanks a lot for help.
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Post by Zefz »

If we are to integrate Egoboo into the Amiga platform, we will need a new "amiga_file.c" for the Amiga specific file system as birdsey mentioned.

I do not know if Amiga has the same limits as unix, but you could simply define __UNIX__ if _amigaos4__ is defined.
kas1e
Acid Blob (New member)
Acid Blob (New member)
Posts: 7
Joined: Thu Aug 26, 2010 3:27 pm

Post by kas1e »

@Zefz
If we are to integrate Egoboo into the Amiga platform, we will need a new "amiga_file.c" for the Amiga specific file system as birdsey mentioned.
Yes, of course. Here is amiga_file.c. And there is a Makefile (game/Makefile), in which i add amiga-specific stuff which is need it for linking.
I do not know if Amiga has the same limits as unix, but you could simply define __UNIX__ if _amigaos4__ is defined.
AmigaOS its not fully linux of course (just have support of almost all posix functions, all those tools like sh/gmake/perl/bison/yawk and so on), but still a bit different, and the most real different in terms of porting any app to it: patchs. Our patch are looks like this : partiion:dir/dir2/dir3. Or we have for current dir "PROGDIR:", not something like "./" on linux. But that is easyly changes in code of course (what i do in the amiga_file.c).

I just trying to say (sorry for bad english), that when GCC do work on amigaos, it will always skip those ifdefs about __unix__ , so, i think that maybe there is something very important in some part of some source file, and i need to change it on __amigaos4__. Because even if it compies with __unix__ fine, it still skips those parts which unix_only related , and maybe because of that can be problems ..

I will try to define for now __unix__ as __amigaos4__ and will check what will happenes after. egooboo.h are good for that ?
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Post by Zefz »

Use egoboo_platform.h for platform specific stuff. I take it you use linux_sys.c as the entry point of your program?
Post Reply