Jump to content

AppleALC — dynamic AppleHDA patching


  • Please log in to reply
1863 replies to this topic

#1
vit9696

vit9696

    InsanelyMac Geek

  • Developers
  • 249 posts
  • Gender:Male

*
POPULAR

Hello,

This is going to be a support/discussion topic of AppleALC on InsanelyMac. 
AppleALC is a kernel extension allowing you to enable native apple HD audio without any filesystem modifications. It dynamically injects the necessary modifications to AppleHDA (and other kexts) including the

layouts, and makes your audio work starting from the OS installation.

 

It should be noted that AppleALC starting with version 1.1.0 requires Lilu.kext to be put in the same folder as AppleALC.kext. See this topic for more details.

 

For quite some time we are trying to obtain the necessary information about AppleALC codec compatibility. If you use something, please, consider checking the compatibility table (do not worry, it is in English), and report (here) on your codec. We are also looking for all the possible revisions of the codec, if we do not have the revisions listed for your codec please report as well. Thanks for understanding. 

 

The report is meant to contain:

1. Laptop model/Motherboard model
2. Codec name
3. Layout used with the info what works for you (ideally if you try them all)
4. OS X versions you tried
5. Autogenerated Info.plist made with the help of this utility.

 
All the details including the source code are available on github:
https://github.com/vit9696/AppleALC
Some short wiki articles explaining the usage are included.
 
As for now the project is relatively immature without practically any codec support. But it should be pretty easy to add more of them, I am hoping for the support of the "community" :)
If you have any issues, better report them on github for structural reasons.



#2
smolderas

smolderas

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 359 posts
  • Gender:Male

Is this needed to be in /S/L/E, or can it be in /L/E or better in /EFI/CLOVER/.../kexts...?



#3
vit9696

vit9696

    InsanelyMac Geek

  • Developers
  • 249 posts
  • Gender:Male

As you wish. The point was no system modifications, so I would rather use /EFI/CLOVER out of the three.



#4
smolderas

smolderas

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 359 posts
  • Gender:Male

As you wish. The point was no system modifications, so I would rather use /EFI/CLOVER out of the three.

Nice. I will definitely give it a try...



#5
Rodion2010

Rodion2010

    InsanelyMac Protégé

  • Members
  • PipPip
  • 50 posts

Attached File  Resources.zip   22.38KB   71 downloads

Resources for HDA Codec #0: Analog Devices AD1988B

HDA Codec ID: 0x11d4198b
Vendor: 0x11d4
Device: 0x198b

 

but it doesn't work

what's wrong?



#6
FredWst

FredWst

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 584 posts
  • Gender:Male
  • Location:France

Hi,

 

I compile for alc 892.

I get this error at boot :

 

AppleALC: mach @ no slide is present.

AppleALC: alc @ failed to setup kext hooking.

 

no error if i load it with kextload.

 

Fred



#7
vit9696

vit9696

    InsanelyMac Geek

  • Developers
  • 249 posts
  • Gender:Male

attachicon.gifResources.zip

Resources for HDA Codec #0: Analog Devices AD1988B

HDA Codec ID: 0x11d4198b
Vendor: 0x11d4
Device: 0x198b

 

but it doesn't work

what's wrong?

Hi,

 

I assume you are the same guy from life, therefore I will reply there.

 

 

Hi,

 

I compile for alc 892.

I get this error at boot :

 

AppleALC: mach @ no slide is present.

AppleALC: alc @ failed to setup kext hooking.

 

no error if i load it with kextload.

 

Fred

 

Hi,

Please enable alc_dbg in boot arguments, and pass me the whole log grepped by AppleALC.



#8
FredWst

FredWst

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 584 posts
  • Gender:Male
  • Location:France

Hi,

 

With last commit, ALC 892 working fine.

 

Attached File  ALC892.zip   13.35KB   178 downloads

 

Always see some errors about AppleHDA in log, think it's cause to audio HD4600.

 

Can we patch AppleHDAController ? look likes yes ...

 

Fred



#9
vit9696

vit9696

    InsanelyMac Geek

  • Developers
  • 249 posts
  • Gender:Male
Yes we can. You need to follow the instructions to do this…
In brief: add a new kext to Kexts.plist, add a patch to a corresponding codec plist.

#10
FredWst

FredWst

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 584 posts
  • Gender:Male
  • Location:France

i've try to patch hd4600.

But does not works.

I don't forget to add AppleHDAController to kext.plist

 

Attached File  ALC892-with patch hdmi hd4600.zip   12.61KB   58 downloads

Attached File  debug.log.zip   2.25KB   11 downloads

 

Patch is not like other, Toleda do that.

 

# HD4600/0c0c HDMI El Capitan

sudo xxd -ps /System/Library/Extensions/AppleHDA.kext/Contents/Plugins/AppleHDAController.kext/Contents/MacOS/AppleHDAController | tr -d > /tmp/AppleHDAController.txt

sudo perl -pi -e 's|3d0c0a0000|3d0c0c0000|g' /tmp/AppleHDAController.txt

sudo xxd -r -p /tmp/AppleHDAController.txt /System/Library/Extensions/AppleHDA.kext/Contents/Plugins/AppleHDAController.kext/Contents/MacOS/AppleHDAController

sudo rm -R /tmp/AppleHDAController.txt

 

 

One more thing, debug boot-args parsing does not work for me.

To get debug i need to : debugEnabled = true; //PE_parse_boot_argn(booatargDebug, buf, sizeof(buf));

 

Fred

 

PS Bootloader Ozmosis, GA-H97N-WIFI



#11
vit9696

vit9696

    InsanelyMac Geek

  • Developers
  • 249 posts
  • Gender:Male

Indeed AppleHDAController patching is currently broken, thanks for the log which made it clear.

Although, it might be a little problematic. Given that we detect the codecs by AppleHDAController results.

Do you have any good ideas on how to detect them before AppleHDAController loads other than direct probing?

 

Perhaps, 3d0c0a0000 → 3d0c0c0000 patching can be used regardless of the codec? Does this patch conflict with anything? Do AppleHDAController patches need anything special other than that for other platforms?

 

From what I can from the disassembly tell this patch simply changes the some id from 0xA0C to 0xC0C.

 if ( v15 != 0xC0C /* this thing */ && v15 != 0xD0C && v15 != 0x160C )  {
    LODWORD(v16) = (*(int (__fastcall **)(AppleHDAController *, _QWORD, _BYTE *))(*(_QWORD *)v4 + 696LL))(
                     v4,
                     AppleHDAController::DPAudioDeviceExclusionString,
                     byte_11FE8);

or

bool __fastcall AppleHDAController::shouldSetGraphicsClockDivider(AppleHDAController *this){
  int id; // eax@2
  bool result; // al@5


  result = 0;
  if ( *((_DWORD *)this + 948) == 0x8086 )      // Intel
  {
    id = *((_DWORD *)this + 949);
    if ( id == 0xA0C || id == 0xD0C || id == 0x160C )
      result = 1;
  }
  return result;
}

Making it not to exclude 0xC0C from the supported list.

May it be a good idea to replace the jmps instead of the id itself? Or that is going to conflict with some completely unsupported devices?

 

As for boot-args, the debug argument changed to -alcdbg. Are you sure you use the new one?



#12
Hiko

Hiko

    InsanelyMac Protégé

  • Members
  • Pip
  • 25 posts
  • Gender:Male

Will Creative CA0132 work via your work?

 

Thanks!



#13
vit9696

vit9696

    InsanelyMac Geek

  • Developers
  • 249 posts
  • Gender:Male

Hiko, it's in your hands :) 



#14
FredWst

FredWst

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 584 posts
  • Gender:Male
  • Location:France

Indeed AppleHDAController patching is currently broken, thanks for the log which made it clear.

Although, it might be a little problematic. Given that we detect the codecs by AppleHDAController results.

Do you have any good ideas on how to detect them before AppleHDAController loads other than direct probing?

 

Perhaps, 3d0c0a0000 → 3d0c0c0000 patching can be used regardless of the codec? Does this patch conflict with anything? Do AppleHDAController patches need anything special other than that for other platforms?

 

From what I can from the disassembly tell this patch simply changes the some id from 0xA0C to 0xC0C.

 if ( v15 != 0xC0C /* this thing */ && v15 != 0xD0C && v15 != 0x160C )  {
    LODWORD(v16) = (*(int (__fastcall **)(AppleHDAController *, _QWORD, _BYTE *))(*(_QWORD *)v4 + 696LL))(
                     v4,
                     AppleHDAController::DPAudioDeviceExclusionString,
                     byte_11FE8);

or

bool __fastcall AppleHDAController::shouldSetGraphicsClockDivider(AppleHDAController *this){
  int id; // eax@2
  bool result; // al@5


  result = 0;
  if ( *((_DWORD *)this + 948) == 0x8086 )      // Intel
  {
    id = *((_DWORD *)this + 949);
    if ( id == 0xA0C || id == 0xD0C || id == 0x160C )
      result = 1;
  }
  return result;
}

Making it not to exclude 0xC0C from the supported list.

May it be a good idea to replace the jmps instead of the id itself? Or that is going to conflict with some completely unsupported devices?

 

As for boot-args, the debug argument changed to -alcdbg. Are you sure you use the new one?

 

Hi,

 

Debug trace is ok now with new option -alcdbg. (Update wiki, if not done)

I try to patch with dsdt but does not work.

i'm not able to help on this kind of issue, i've no skill on that.

But what i find strange is the way taken by Toleda to patch this kext.

May be he can explain why it can't be done like other ?

 

Fred



#15
vit9696

vit9696

    InsanelyMac Geek

  • Developers
  • 249 posts
  • Gender:Male
I had a talk with a few people, and I think I got the point of this kind of patching.
Such patches are not codec patches but codec controller patches. Therefore they are not dependent on codec detection.
I am writing an update in the periods I have free time, hopefully it will be ready soon. In a new version one will be able to apply codec controller patches and therefore use AppleALC for Intel HD4600 HDMI audio, x99 analog audio, and possibly more.

#16
FredWst

FredWst

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 584 posts
  • Gender:Male
  • Location:France

I had a talk with a few people, and I think I got the point of this kind of patching.
Such patches are not codec patches but codec controller patches. Therefore they are not dependent on codec detection.
I am writing an update in the periods I have free time, hopefully it will be ready soon. In a new version one will be able to apply codec controller patches and therefore use AppleALC for Intel HD4600 HDMI audio, x99 analog audio, and possibly more.

 

 

Very nice, as i see you able to patch on the fly, should be interesting to patch other kind of kext. i think about usb limit. ;)

So i know it's not the goal of you project...

 

Fred



#17
TheRacerMaster

TheRacerMaster

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 832 posts
  • Gender:Male

Will test ASAP, nice work. This is a great idea, now audio can work regardless of SIP settings/etc and with a clean install.

 

Edit: Working fine with ALC898 here. Removed /L/E/AppleHDA898.kext (generated with Pike's script) and deleted Clover kext patch entries, then rebuilt kext caches - audio is still working well.



#18
Rockey12

Rockey12

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 666 posts
  • Gender:Male
  • Location:Earth
  • Interests:no comi

Any hope for  ALC262 10EC0262    283902562



#19
pmcnano

pmcnano

    Preguntaaame caom!

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,240 posts
  • Gender:Male
  • Location:Merida, Mexico

@vit9696 Doesn't seem to work when using Nvidia Web Drivers. Using OSX Native drivers does load sound devices though.



#20
vit9696

vit9696

    InsanelyMac Geek

  • Developers
  • 249 posts
  • Gender:Male

I added controller patching code to trunk with x99/hd4600 examples. HDMI audio should be addible now.

Any other (even non-audio) kext patching can be done as well, the platform allows it, just edit the plists.

 

Rockey12, pretty much no one here will write anything for you, and me in particular. There is a decent instruction, follow it and make the codec supported if it is not already. Why do people think I am the one going to set their audio up after creating a platform and even writing the docs on how to use it.

 

pmcnano, I use nvidia web drivers here, and the system boots at least. No idea what fails for you, be more descriptive if you want to get a decent reply.







1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

© 2017 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy