Skip to content

Conversation

@Kalamatee
Copy link
Contributor

Apply updates to the AROS build so that it works now that dhewm3 uses SDL2, and newer OpenAL requirements.
Use consistent formatting in the code, so it matches existing code.
Adjust startup code to allocate 1MB stack space.
Check in the directory the game has been launched from, for mod components before the game directory so it doesn't use dooms config instead of the mods.
Don't use auto-opened bsdsocket.library, but open it ourselves (and close on exit).
Remove old dll code - use the dynmodule library provided by AROS.

@Kalamatee Kalamatee changed the title A doom3 AROS build fixes and code cleanup. Aug 9, 2025
@Kalamatee
Copy link
Contributor Author

What's needed to get these fixes merged @DanielGibson?

@DanielGibson
Copy link
Member

time and motivation (for review) on my side

{
return (INT_PTR)::ShellExecuteA(NULL, "open", path, NULL, NULL, SW_SHOWDEFAULT) > 32;
}
#elif defined(__AROS__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patching Dear ImGui is problematic, because I usually just copy over the source files of new upstream versions..
Could you try to get this upstream so next time I update ImGui it doesn't break AROS?

@Kalamatee
Copy link
Contributor Author

Kalamatee commented Oct 22, 2025 via email

@DanielGibson
Copy link
Member

Any update on ImGui?

Also, I just merged something that creates a merge conflict (I added functions for getting the the time and sleeping at higher resolutions), could you rebase to current master?

Thanks :)

# use libdynmod instead of including "dll" code
# clean up code to use consistent formatting
# use NewStackSwap to allocate 1MB stack, and handle exit() from the swapped stack gracefully.
# dont use autoopened SocketBase and open it ourselves.
# Check in the mod's directory first when opening files (se e.g. Rivensin can be installed in its own folder outside the doom folder).
move the timer init call to the AROS_EarlyInit function.
…sure it is used in the build.

curl needs libzstd.a, in newer AROS builds.
@Kalamatee
Copy link
Contributor Author

Hi Daniel, I have rebased and reverted the imgui changes/adapted the build, so they are not necessary. I can confirm it successfully builds.

@DanielGibson
Copy link
Member

Awesome, thank you!

@DanielGibson DanielGibson merged commit 47ae272 into dhewm:master Nov 23, 2025
4 checks passed
@DanielGibson
Copy link
Member

BTW, is it correct that AROS only has millisecond-precision in clock_gettime()?
If it provided something with higher resolution the game could run smoother

@Kalamatee
Copy link
Contributor Author

I believe so - but would need to look into it. We did have initial support for HPET, but I'm not sure how complete it is, or if it exposes higher precision.

@DanielGibson
Copy link
Member

Note that dhewm3 doesn't necessarily need a high precision/high frequency scheduler, just a precise time source (where querying it has relatively low overhead).

In the Windows implementation it does the last millisecond or so of waiting with a busy loop only slowed down by CPU PAUSE instructions:

void Sys_SleepUntilPrecise( double targetTimeMS ) {
double msec = targetTimeMS - Sys_MillisecondsPrecise();
if ( msec < 0.01 ) // don't bother for less than 10usec
return;
if ( msec > 2.0 ) {
// Note: Theoretically one could use SetWaitableTimer() and WaitForSingleObject()
// for higher precision, but last time I tested (on Win10),
// in practice that also only had millisecond-precision
dword sleepMS = msec - 1.0; // wait for last MS or so in busy(-ish) loop below
Sleep( sleepMS );
}
// wait for the remaining time with a busy loop, as that has higher precision
do {
#ifdef D3_CpuPause
for ( size_t i=0; i < pauseLoopsPer5usec; ++i ) {
// call it 4 times per loop, so the ratio between pause and loop-instructions is better
D3_CpuPause(); D3_CpuPause(); D3_CpuPause(); D3_CpuPause();
}
#endif
msec = targetTimeMS - Sys_MillisecondsPrecise();
} while ( msec >= 0.01 );
}

On Linux it does the same for the last 100 microseconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants