@Capehill Another issue is probabaly not related to SDL1 itself (or maybe related, just i do not know at moment), and its some strange one.
I found that when i run some game (sdl1/gl4es/etc) in fullscreen mode. When i run it just as it, and enable fps counter, it show me 30 fps for example. And everything is looks just like 30 fps.
Then, when i do "amiga+m", and made by mouse workbench window (or any other window on workbench) to be active, i still have on other screen those 30 fps (as expected), but when i jump back to the game screen again and make it active, this time fps is doubled to 70 and everythng start to looks like its now indeed 70 fps.
Then, any switch back to workbench and making it active, doing game be 30 fps (as exptected as it not active anymore), and swithcing back to game make it 70fps. But not from first time! I.e. when you run it, i can see workbench is not active, and that my game active, but technically like not :)
It seems that when i run game first time (and even if i operate in it, play in it, i.e. its active), something busy happens. Once i made workbench active and then back to the game: fps back to normal.
I may think of course that its game doing something, but "depending on screens" its just amiga-thing, so maybe something on our side ?
Sorry its a bit unclear, and i can't say if it SDL1 or what else , as i can't find any other game/test which can show the same.
I probabaly can do some hack like when game runs, call intuition Lock/Active of workbench, and then back again to game, but that strange anyway..
EDIT:
I think it can be something about the way how SDL initialisation done , maybe only with this game i have some sort of combo of dbl-bufergin / vsync and something else which didn't showups before.
I currently just hack the game's init code like this:
// get workbnech screen and first window pointer, so to make it active when need it
wb_screen = IIntuition->LockPubScreen(NULL);
first_wb_window = wb_screen->FirstWindow;
IIntuition->UnlockPubScreen(NULL, wb_screen);
#endif
.... init SDL/opengl/etc ...
#ifdef __amigaos4__
// get our new screen pointer and first window to make it active when need it
long lock = IIntuition->LockIBase(0);
game_screen = ((struct IntuitionBase *)IntuitionBase)->ActiveScreen;
first_game_window = game_screen->FirstWindow;
IIntuition->UnlockIBase(lock);
// activate the first window on workbench
IIntuition->ActivateWindow(first_wb_window);
// active our game's window on new screen back to have stable FPS back.
IIntuition->ActivateWindow(first_game_window);
// nothing to do in minimized state except waiting until this changes
if (irrlichtDevice->isWindowMinimized())
{
irrlichtDevice->sleep(100);
continue;
}
UpdateSound();
// inactive - just update less often
if (!irrlichtDevice->isWindowActive() )
{
irrlichtDevice->sleep(10);
}
// Load a new ad. Doing that with a small delay because showing ad's is in an own thread
// and requesting new ones before last show is through can mess up things.
if ( mNeedAd && newTime > mLastAdTime + 1000 )
{
mNeedAd = false;
if ( mAdvert )
mAdvert->request(EAT_FULLSCREEN);
}
// begin-scene early do allow drawing debug-output in the rest of updates
videoDriver->beginScene(true, true, video::SColor(150,50,50,200));
if ( mDrawAiTrack )
{
APP.GetLevel()->GetAiTrack().Draw();
}
videoDriver->endScene();
mGui->Update(newTime);
if ( runningAppTest )
{
if ( !mAppTester->Update() )
break;
}
// be nice
irrlichtDevice->yield();
}
}
See there:
// inactive - just update less often if (!irrlichtDevice->isWindowActive() ) { irrlichtDevice->sleep(10); }
Check in if windowactive and if not , less update with sleep(10), so exactly to reduce FPS.
I comment out that code, and everything works fine from start :)
So i checked and its just irrlicht's isWindowActive didn't return that it active (proved that by putting printfs inside), while it is. We lately in irrlicht itself fix some thing in that terms with one of remaining authors, and i just forget to add that fix to the irrlicht's code coming with game itself, and so it always return on first run that window is inactive.
But if you didn't point out on "main game loop with delay" i for sure dind't find it, so thank as usuall again :)
Quote:
How about this SDL1/GL4ES branch? I don't think I have seen the code lately.
I will put tomorrow on github just the changed files of SDL1/SDL2 i touch for gl4es (so can be easy seen what is changed exactly). I plan to do it before anyway, so at least that will be reasson :)
Edited by kas1e on 2019/10/18 22:12:38 Edited by kas1e on 2019/10/18 22:13:12 Edited by kas1e on 2019/10/18 22:13:48 Edited by kas1e on 2019/10/18 22:24:55
[os4_initialize] SDL 1.2.15
[os4timer_initialize] timer=0x6FF51050
[os4timer_initialize] ITimer=0x6FF9E380
[os4timer_Init] Initializing timer for process 0x67D12C90
[os4timer_Init] Done
[os4thread_initialize] Primary process 0x67D12C90
[os4video_initialize] Device opened
[os4video_CreateDevice] Creating OS4 video device
[os4video_FindApplicationName] Current program name 'a'
[os4video_FindApplicationName] Application name: 'a'
[os4video_CreateDevice] Device created
[os4video_VideoInit] Free video memory 203895552
[SDL_DestroyMutex] NULL mutex
[os4video_CreateWMCursor] Creating cursor 16x16
[os4video_CreateWMCursor] cursor = 0x639D8010
[os4video_ShowWMCursor] Setting cursor 0x639D8010
[os4video_SetVideoMode] Requesting new video mode 1024x768x24
[os4video_SetVideoMode] Requested flags: ANYFORMAT OPENGL
[os4video_SetVideoMode] Current mode 0x0x32
[os4video_SetVideoMode] Current mode flags
[os4video_SetVideoMode] Current hwdata 0x00000000
[os4video_SetVideoMode] Creating new display
[os4video_SetVideoMode] Deleting old display
[os4video_SetVideoMode] Opening new display
[os4video_CreateDisplay] Creating a 1024x768x24 windowed display
[os4video_CreateDisplay] Screen depth: 32 pixel format: 6
[os4video_GetBestWindowPosition] Visible screen: (0,0)/(1920x1080)
[os4video_OpenWindow] Trying to open window at (443,140) of size (1024x768)
[os4video_CreateIconifyGadget] Called
[os4video_GL_Init] Initializing MiniGL (window 0x687FAF50)...
[os4video_GL_Init] MiniGLBase 0x63CB9018
[os4video_GL_Init] IMiniGL 0x63D81430
[os4video_AllocateBitMap] Allocating bitmap 1024*768*16
[os4video_AllocateBitMap] Allocating bitmap 1024*768*16
[os4video_GL_Init] MiniGL context 0x62F42F10 (0x62F42F10)
[os4video_SetVideoMode] New display created
[os4video_SetVideoMode] Obtained flags: ANYFORMAT OPENGL PREALLOC
[os4video_ShowWMCursor] Setting cursor 0x639D8010
[os4video_ResetCursor] Cursor image set
[os4video_GL_GetProcAddress] Function 'glBegin' loaded at 0x7F5E404C
[os4video_GL_GetProcAddress] Function 'glBindTexture' loaded at 0x7F5E7150
[os4video_GL_GetProcAddress] Function 'glBlendFunc' loaded at 0x7F5E39FC
[os4video_GL_GetProcAddress] Function 'glColor4f' loaded at 0x7F5E4FB8
[os4video_GL_GetProcAddress] Function 'glCopyTexImage1D' loaded at 0x7F5E7240
[os4video_GL_GetProcAddress] Function 'glDisable' loaded at 0x7F5E3BB0
[os4video_GL_GetProcAddress] Function 'glEnable' loaded at 0x7F5E3B94
[os4video_GL_GetProcAddress] Function 'glEnd' loaded at 0x7F5E4064
[os4video_GL_GetProcAddress] Function 'glFlush' loaded at 0x7F5E3D44
[os4video_GL_GetProcAddress] Function 'glGenTextures' loaded at 0x7F5E7110
[os4video_GL_GetProcAddress] Function 'glGetString' loaded at 0x7F5E3D18
[os4video_GL_GetProcAddress] Function 'glLoadIdentity' loaded at 0x7F5E3E60
[os4video_GL_GetProcAddress] Function 'glMatrixMode' loaded at 0x7F5E3DD0
[os4video_GL_GetProcAddress] Function 'glOrtho' loaded at 0x7F5E3DE8
[os4video_GL_GetProcAddress] Function 'glPixelStorei' loaded at 0x7F5E6C4C
[os4video_GL_GetProcAddress] Function 'glPopAttrib' loaded at 0x7F5E3CAC
[os4video_GL_GetProcAddress] Function 'glPopClientAttrib' loaded at 0x7F5E3CD8
[os4video_GL_GetProcAddress] Function 'glPopMatrix' loaded at 0x7F5E3E4C
[os4video_GL_GetProcAddress] Function 'glPushAttrib' loaded at 0x7F5E3C94
[os4video_GL_GetProcAddress] Function 'glPushClientAttrib' loaded at 0x7F5E3CC0
[os4video_GL_GetProcAddress] Function 'glPushMatrix' loaded at 0x7F5E3E38
[os4video_GL_GetProcAddress] Function 'glTexCoord2f' loaded at 0x7F5E5B9C
[os4video_GL_GetProcAddress] Function 'glTexEnvf' loaded at 0x7F5E6E38
[os4video_GL_GetProcAddress] Function 'glTexImage2D' loaded at 0x7F5E7088
[os4video_GL_GetProcAddress] Function 'glTexParameteri' loaded at 0x7F5E6F30
[os4video_GL_GetProcAddress] Function 'glTexSubImage2D' loaded at 0x7F5E71E4
[os4video_GL_GetProcAddress] Function 'glVertex2i' loaded at 0x7F5E40D0
[os4video_GL_GetProcAddress] Function 'glViewport' loaded at 0x7F5E3E10
[os4video_GL_MakeCurrent] Context 0x62F42F10
[os4video_ListModes] Listing 32-bit modes with format=6
[os4video_FreeWMCursor] Freeing 0x639D8010
[os4video_VideoQuit] In VideoQuit, this = 0x660F02F0
[os4video_VideoQuit] DeleteCurrentDisplay
[os4video_GL_Term] Here
[os4video_DeleteCurrentDisplay] Removing gadget
[os4video_DeleteCurrentDisplay] Disposing image
[os4video_DeleteCurrentDisplay] Closing window 0x687FAF50
[os4video_VideoQuit] Checking pubscreen
[os4video_FreeHWSurface] Freeing HW surface 0x62C2CF80
[os4video_quit] Deleting input device
[os4video_quit] Deleting IORequest
[os4video_quit] Deleting MsgPort
[os4video_quit] Done
[os4thread_quit] Killing all remaining processes
[os4thread_quit] Terminating lists
[os4timer_Destroy] Freeing timer for process 0x67D12C90
[os4thread_quit] Done
[os4timer_quit] Called
[os4_quit] SDL QUIT
[os4_quit] Not initialized
[os4_quit] SDL QUIT
And that serial log if i change in above test case 24 on 32 in the SetVideoMode call :
[os4_initialize] SDL 1.2.15
[os4timer_initialize] timer=0x6FF51050
[os4timer_initialize] ITimer=0x6FF9E380
[os4timer_Init] Initializing timer for process 0x67D12C90
[os4timer_Init] Done
[os4thread_initialize] Primary process 0x67D12C90
[os4video_initialize] Device opened
[os4video_CreateDevice] Creating OS4 video device
[os4video_FindApplicationName] Current program name 'a'
[os4video_FindApplicationName] Application name: 'a'
[os4video_CreateDevice] Device created
[os4video_VideoInit] Free video memory 203895552
[SDL_DestroyMutex] NULL mutex
[os4video_CreateWMCursor] Creating cursor 16x16
[os4video_CreateWMCursor] cursor = 0x639D8010
[os4video_ShowWMCursor] Setting cursor 0x639D8010
[os4video_SetVideoMode] Requesting new video mode 1024x768x32
[os4video_SetVideoMode] Requested flags: ANYFORMAT OPENGL
[os4video_SetVideoMode] Current mode 0x0x32
[os4video_SetVideoMode] Current mode flags
[os4video_SetVideoMode] Current hwdata 0x00000000
[os4video_SetVideoMode] Creating new display
[os4video_SetVideoMode] Deleting old display
[os4video_SetVideoMode] Opening new display
[os4video_CreateDisplay] Creating a 1024x768x32 windowed display
[os4video_CreateDisplay] Screen depth: 32 pixel format: 6
[os4video_GetBestWindowPosition] Visible screen: (0,0)/(1920x1080)
[os4video_OpenWindow] Trying to open window at (443,140) of size (1024x768)
[os4video_CreateIconifyGadget] Called
[os4video_GL_Init] Initializing MiniGL (window 0x687FAF50)...
[os4video_GL_Init] MiniGLBase 0x63CB9018
[os4video_GL_Init] IMiniGL 0x63D81430
[os4video_AllocateBitMap] Allocating bitmap 1024*768*16
[os4video_AllocateBitMap] Allocating bitmap 1024*768*16
[os4video_GL_Init] MiniGL context 0x62F42F10 (0x62F42F10)
[os4video_SetVideoMode] New display created
[os4video_SetVideoMode] Obtained flags: ANYFORMAT OPENGL PREALLOC
[os4video_ShowWMCursor] Setting cursor 0x639D8010
[os4video_ResetCursor] Cursor image set
[os4video_GL_GetProcAddress] Function 'glBegin' loaded at 0x7F5E404C
[os4video_GL_GetProcAddress] Function 'glBindTexture' loaded at 0x7F5E7150
[os4video_GL_GetProcAddress] Function 'glBlendFunc' loaded at 0x7F5E39FC
[os4video_GL_GetProcAddress] Function 'glColor4f' loaded at 0x7F5E4FB8
[os4video_GL_GetProcAddress] Function 'glCopyTexImage1D' loaded at 0x7F5E7240
[os4video_GL_GetProcAddress] Function 'glDisable' loaded at 0x7F5E3BB0
[os4video_GL_GetProcAddress] Function 'glEnable' loaded at 0x7F5E3B94
[os4video_GL_GetProcAddress] Function 'glEnd' loaded at 0x7F5E4064
[os4video_GL_GetProcAddress] Function 'glFlush' loaded at 0x7F5E3D44
[os4video_GL_GetProcAddress] Function 'glGenTextures' loaded at 0x7F5E7110
[os4video_GL_GetProcAddress] Function 'glGetString' loaded at 0x7F5E3D18
[os4video_GL_GetProcAddress] Function 'glLoadIdentity' loaded at 0x7F5E3E60
[os4video_GL_GetProcAddress] Function 'glMatrixMode' loaded at 0x7F5E3DD0
[os4video_GL_GetProcAddress] Function 'glOrtho' loaded at 0x7F5E3DE8
[os4video_GL_GetProcAddress] Function 'glPixelStorei' loaded at 0x7F5E6C4C
[os4video_GL_GetProcAddress] Function 'glPopAttrib' loaded at 0x7F5E3CAC
[os4video_GL_GetProcAddress] Function 'glPopClientAttrib' loaded at 0x7F5E3CD8
[os4video_GL_GetProcAddress] Function 'glPopMatrix' loaded at 0x7F5E3E4C
[os4video_GL_GetProcAddress] Function 'glPushAttrib' loaded at 0x7F5E3C94
[os4video_GL_GetProcAddress] Function 'glPushClientAttrib' loaded at 0x7F5E3CC0
[os4video_GL_GetProcAddress] Function 'glPushMatrix' loaded at 0x7F5E3E38
[os4video_GL_GetProcAddress] Function 'glTexCoord2f' loaded at 0x7F5E5B9C
[os4video_GL_GetProcAddress] Function 'glTexEnvf' loaded at 0x7F5E6E38
[os4video_GL_GetProcAddress] Function 'glTexImage2D' loaded at 0x7F5E7088
[os4video_GL_GetProcAddress] Function 'glTexParameteri' loaded at 0x7F5E6F30
[os4video_GL_GetProcAddress] Function 'glTexSubImage2D' loaded at 0x7F5E71E4
[os4video_GL_GetProcAddress] Function 'glVertex2i' loaded at 0x7F5E40D0
[os4video_GL_GetProcAddress] Function 'glViewport' loaded at 0x7F5E3E10
[os4video_GL_MakeCurrent] Context 0x62F42F10
[os4video_ListModes] Listing 32-bit modes with format=6
[os4video_MakeResArray] 5 video modes (allocating a 64-byte array)
[fillModeArray] Added mode 640x480
[fillModeArray] Added mode 800x600
[fillModeArray] Added mode 1024x768
[fillModeArray] Added mode 1280x768
[fillModeArray] Added mode 1920x1080
[os4video_FreeWMCursor] Freeing 0x639D8010
[os4video_VideoQuit] In VideoQuit, this = 0x660F02F0
[os4video_VideoQuit] DeleteCurrentDisplay
[os4video_GL_Term] Here
[os4video_DeleteCurrentDisplay] Removing gadget
[os4video_DeleteCurrentDisplay] Disposing image
[os4video_DeleteCurrentDisplay] Closing window 0x687FAF50
[os4video_VideoQuit] Checking pubscreen
[os4video_FreeHWSurface] Freeing HW surface 0x63240F80
[os4video_quit] Deleting input device
[os4video_quit] Deleting IORequest
[os4video_quit] Deleting MsgPort
[os4video_quit] Done
[os4thread_quit] Killing all remaining processes
[os4thread_quit] Terminating lists
[os4timer_Destroy] Freeing timer for process 0x67D12C90
[os4thread_quit] Done
[os4timer_quit] Called
[os4_quit] SDL QUIT
As i can see from both logs, it says "Listing 32-bit modes with format=6" when we do call SDL_ListModes, but then it fail on os4 if setvideomode call was with 16 or 24, or anything else but not 32. And when we want to list 32 bit modes after, it by some reasons didn't go till the point when call os4video_MakeResArray().
@Capehill I still think something wrong with sound initialisation at least in SDL1 (but if SDL2 share the same amigaos4 specific code to initialize audio, then it probabaly have same issue).
Issue, is that once we initialize SDL audio, we always heard some noice-small-micro sound. Like, we didn't clear buffers before and there is some left over. Or like, we set in amigaos4 specific code some "mute" to high, or dunno ..
But visually, every running SDL app which will use sound, have that strange noice-micro-sound.
Can't say currently is it with just SDL_INIT happens or when we init SDL_Mixer or OpenAL, or when .. But what for sure , is that every game / app which use SDL1 with sound, at begining always have that "noice-micro-crack-sound" sound.
I just tested it with some simple irrlicht test-case, and yeah, joystick didn't work. _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ define of course defines and code inside compiles for sure.
Irrlichts test case says "Joystick support is enabled and 0 joystick(s) are present".
@Capehill Damn! As I use some 2018 repo on top of which I add your fixes (to avoid with every new change add gl4es diffs), I simply not apply that one, as for all 4 gamepads I have none work as should in AmigaOS's amigainput. Just one seems detected, but then when I calibrate it, it always works like "left" pressed, and buttons swapped wrong. Not sure how to deal with that.
Because of that just skipped that fix before.. Will check it all, thanks for pointing out!
@Capehill Probabaly its bug, but libSDL.so for "version" always show "SDL1_2_15 1.4 (22.01.2018)" (And i found inside of .so the same string for VER$), and does not matter when you build it. As i see versioning and getting date works ok for SDL2, can it be added to SDL1 as well ? (Seems it was before, just didn't works now).
That need it so we will know date of build, to compare things. As for now i found some bug, and it hard to track down to some specific version as since some time any version we build in repo, return that date.
The last public 1.2.15 release was in June 2019 but the SDL_LoadObject was added in November. To get it today, you need to build the library which is a simple task to do.