Merge pull request #1591 from Lazerbeak12345/add-missing-open-default-component

fix(CarbonCore): add OpenDefaultComponent stub
This commit is contained in:
CuriousTommy 2025-05-20 15:55:28 -07:00 committed by GitHub
commit b7a59db91e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -138,6 +138,8 @@ long CountComponents(ComponentDescription* desc);
OSErr OpenAComponent(Component comp, ComponentInstance* out);
ComponentInstance OpenComponent(Component comp);
ComponentInstance OpenDefaultComponent(OSType componentType, OSType componentSubType);
OSErr CloseComponent(ComponentInstance inst);
Component RegisterComponent(ComponentDescription *cd, ComponentRoutineUPP componentEntryPoint, SInt16 global,

View File

@ -22,6 +22,11 @@ along with Darling. If not, see <http://www.gnu.org/licenses/>.
#include <CarbonCore/MacMemory.h>
#include "ComponentManager.h"
static int verbose = 0;
__attribute__((constructor)) static void initme(void) {
verbose = getenv("STUB_VERBOSE") != NULL;
}
Component FindNextComponent(Component prev, ComponentDescription* desc)
{
std::vector<Component> components = ComponentManager::instance()->findMatching(desc);
@ -85,6 +90,12 @@ ComponentInstance OpenComponent(Component comp)
return nullptr;
}
ComponentInstance OpenDefaultComponent(OSType componentType, OSType componentSubType)
{
if (verbose) puts("STUB: OpenDefaultComponent called");
return nullptr;
}
OSErr CloseComponent(ComponentInstance inst)
{
return ComponentManager::instance()->dispose(inst);