Char arrays should always end with char value 0, to terminate strings.
If it does have char 0, at end memory garbage is assumed to be part of string, that’s until hits a 0 in memory.
So need to look at code where path is added to ini file, figure out if the char arrays are 0 terminated, then if they are, are buffers the right size, did it allocate memory correct, it can also be something wrong with path and how its initalized, or bug in clib2 / newlib, copy and paste write small test case, try figure out what’s going on.
When allocating memory for char array, it should be x number of char for the string, +1 for the zero termination.
For exsample:
dest = malloc(strlen(src) +1 ); memcpy(dest,src,strlen(src)); // copy the text dest[strlen(src)]=0; // set value after array to 0. (string is stored in index 0 to index string len-1);
ofcouse you should use strdup() or strndup(), but this just a exsample
Edited by LiveForIt on 2022/7/27 17:06:10
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
trying to compile/build on my SAM460ex (so it will take time X-P )
Some questions: 1)I should use afxgroup's clib2(-beta)? 2)On makefile why are you using -gdwarf-2 (instead of -gstabs)? ¿:-/ 3)Tried to build SDL2 with clib2(-beta), but I got: ... In file included from /SDK/local/common/include/proto/minigl.h:31, from src/video/amigaos4/SDL_os4opengl.c:30: /SDK/local/common/include/interfaces/minigl.h:33:76: error: unknown type name 'MGLScreenModeCallback' 33 | GLint APICALL (*GetSupportedScreenModes)(struct MiniGLIFace *Self, MGLScreenModeCallback CallbackFn); | ^~~~~~~~~~~~~~~~~~~~~ /SDK/local/common/include/interfaces/minigl.h:57:68: error: unknown type name 'MGLLockInfo' 57 | GLboolean APICALL (*LockBack)(struct GLContextIFace *Self, MGLLockInfo *info); | ^~~~~~~~~~~ src/video/amigaos4/SDL_os4opengl.c: In function 'OS4_GL_CreateContext': src/video/amigaos4/SDL_os4opengl.c:208:25: error: 'MGLCC_PrivateBuffers' undeclared (first use in this function) 208 | MGLCC_PrivateBuffers, 2, | ^~~~~~~~~~~~~~~~~~~~ src/video/amigaos4/SDL_os4opengl.c:208:25: note: each undeclared identifier is reported only once for each function it appears in src/video/amigaos4/SDL_os4opengl.c:209:25: error: 'MGLCC_FrontBuffer' undeclared (first use in this function) 209 | MGLCC_FrontBuffer, data->glFrontBuffer, | ^~~~~~~~~~~~~~~~~ src/video/amigaos4/SDL_os4opengl.c:210:25: error: 'MGLCC_BackBuffer' undeclared (first use in this function) 210 | MGLCC_BackBuffer, data->glBackBuffer, | ^~~~~~~~~~~~~~~~ src/video/amigaos4/SDL_os4opengl.c:211:25: error: 'MGLCC_Buffers' undeclared (first use in this function ...
maybe there are new/updated mingl.h header or what I'm missing?
4)If I use "normal" SDL2 static lib will it work or must I use clib(.-beta) SDL2 static lib?
First of all I can compile this on a cross-compiler. Until now, my attemps to build this on native SDK failed. However I haven't tried with latest SDK beta yet on native Amiga.
1) Yes I am using afxgroup clib2 beta..But afaik you have to build on cross-compiler
Could be a bug on clib2. I've changed the entirely function for printf core to accept also wide chars and something could be broken. Can you tell me which function is used to create the INI filename? Are you using the latest released version of clib2?
Yesterday night I was able to compile a very alpha version that can display the game menu without a crash..But it is not possible to start the game yet.
If someone would like to help, I can upload the latest source that I modified somwhere.
I suspect that endianess is the main problem. As I wrote somewhere i've tried to run it but it has a lot of endian problems when read files. So you have to swap everything is needed to load game files
If original soures is used , then yes. But there are source code for 68k port, where all the stuff about endianes dealet with, and based on this port morphos version were done too. So it's matter of found what wrong with it on amigaos4, and if those 68k port sources are used, then issues is not endianes
I have progressed a little bit, now after C&C launches, it plays the intro video, comes with menu screen.
On the menu screen, only "J" and "Enter" works. The fake mouse pointer doesn't move but native hidden amiga native mouse pointer moves and I can click things..
C&C plays the mission video and then a warning requester comes saying out of memory. I can skip the warning.. Gameplay screen comes and moves to the left top of map.
And when I click the mouse, it crashes.
I recorded a brief video that shows what is happening.
1. If you want to know where it crashes, you don’t run stripped executable. when you strip a executable, the debug symbols are removed, this makes your stack trace useless. 2.
When porting things from MorphOS.
look for: #ifdef __morphos__ or #if defined(__morphos__)
change that to: #if defined(__morphos__) || defined(__amigaos4__)
Put in warnings, so know what defines are used. #warning “this part is used”
Did it really run out of memory, or did just fail to load or allocate memory?
Find that code, fill the game with printf’s if you must. printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
There are no MorphOS sources, I am using the Apollo/m68k sources.
"beworld 29 Jun 2022 16:35@Sinan Gürkan Yeah, you can use Arczi sources, i just create my own makefile for MorphOS (sorry i hate cmake lol), but source has same as Arczi."